SP taking 15 minutes, but the same query when executed returns results in 1-2 minutes

前端 未结 11 1147
失恋的感觉
失恋的感觉 2021-02-01 03:22

So basically I have this relatively long stored procedure. The basic execution flow is that it SELECTS INTO some data into temp tables declared with he #

11条回答
  •  猫巷女王i
    2021-02-01 04:04

    1) When you run the query for the first time it may take more time. One more point is if you are using any corellated sub query and if you are hardcoding the values it will be executed for only one time. When you are not hardcoding it and run it through the procedure and if you are trying to derive the value from the input value then it might take more time.

    2) In rare cases it can be due to network traffic, also where we will not have consistency in the query execution time for the same input data.

提交回复
热议问题