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

前端 未结 11 1122
失恋的感觉
失恋的感觉 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 03:44

    I too faced a problem where we had to create some temp tables and then manipulating them had to calculate some values based on rules and finally insert the calculated values in a third table. This all if put in single SP was taking around 20-25 min. So to optimize it further we broke the sp into 3 different sp's and the total time now taken was around 6-8 mins. Just identify the steps that are involved in the whole process and how to break them up in different sp's. Surely by using this approach the overall time taken by the entire process will reduce.

提交回复
热议问题