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

前端 未结 11 1143
失恋的感觉
失恋的感觉 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条回答
  •  逝去的感伤
    2021-02-01 04:03

    I would suggest the issue is related to the type of temp table (the # prefix). This temp table holds the data for that database session. When you run it through your app the temp table is deleted and recreated.
    You might find when running in SSMS it keeps the session data and updates the table instead of creating it. Hope that helps :)

提交回复
热议问题