sql query takes more time when run in a view

后端 未结 3 1342
悲哀的现实
悲哀的现实 2021-01-25 06:23

HI all,

I have a huge sql query. When i put that query in a stored Proc it takes 5 seconds to execute which i run it just as a query it takes 4-5 seconds but when i run

3条回答
  •  遇见更好的自我
    2021-01-25 06:55

    Based on your comment, I suspect you hitting the "predicate pushing" issue (search for this phrase)

    Observation... the WHERE on the LEFT JOIN changes this to a JOIN

    LEFT JOIN RefCountry As DestRefCountry...
    ....
    where (DestRefCountry.RN_Desc = 'United States')
    

提交回复
热议问题