SQLTeam.com | Weblogs | Forums

SQL SERVER 2019 calls to python take too long time, how to optimize

I want to use sp_execute_external_script to operate Python Statistical algorithm, but here’s the problem: there was a five-sec pause when transfer to pyhon code in store procedure,which leads to a bad response from our customers. I wrote external scripts enabled config_value=1 and run_value=1.
In addition, python code runs fast in single Python Executor, but slow in sqlserver store procedure, even the simplest summarize operation.


Why are you calling python from sql stored proc?

Does the stored procedure do anything before the python call to feed some values to the python script or prepare some data to be consumed by python script.
And does the proc do anything after the python call?