how to optimise overlap query

  • in the 2 solution: pass means, in with cte, first, it goes to a temp table then it is read again which is second pass and then where clause is applied logically, physically/actually it might execute the whole cross apply for each row with where clause, in that case also it has more operations per row, though the where clause is quite small.

    in the 1 solution: CROSS APPLY  is extra, becasue first cross apply is applied then where clause is applied logically

    but physically/actually, if it takes only one read then also the following comparison will be done with the where clause, which is little bit extra because all together no of predicates or columns and variables are little bit more with the additional multiplications.

    so if that can be reduced then it will be more help full, though i must say 1 soution is quite better.

    CASE

    WHEN @decBeginStation > @decEndStation THEN -1

    ELSE 1

     

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply