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
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')