Answer by Grant Fritchey
Without seeing the execution plans, I'm speculating, but... the local variable results in a a sample against the statistics of the column while the sub-query is probably converted to a join and either...
View ArticleAnswer by Sacred Jewel
It is not recommended to use the local variables. This is where the problem occurs. When you use local variable, the optiizer somehow is trying to work on another_col = '10' and list_number IS NOT NULL...
View ArticleAnswer by Håkan Winther
In this case I agree with @Sacred Jewel and @rafat. The local variable makes the optimizer to guess the selectivity, on the other hand parameters may cause parameter sniffing. You could take a look at...
View ArticleAnswer by Grant Fritchey
Without seeing the execution plans, I'm speculating, but... the local variable results in a a sample against the statistics of the column while the sub-query is probably converted to a join and either...
View ArticleAnswer by Sacred Jewel
It is not recommended to use the local variables. This is where the problem occurs. When you use local variable, the optiizer somehow is trying to work on another_col = '10' and list_number IS NOT NULL...
View ArticleAnswer by Håkan Winther
In this case I agree with @Sacred Jewel and @rafat. The local variable makes the optimizer to guess the selectivity, on the other hand parameters may cause parameter sniffing. You could take a look at...
View Article
More Pages to Explore .....