CTE Performance

  • Hi,

    I had a performance issue where in the sproc was taking millions of reads. The only modifcation i made was, in the cte within the sproc, i removed the anchore part (which was joining tables and retrieving data) and dumped it in to a table variable, then used the variable as anchore in the CTE. This brought down reads to thousands.

    So the big question here is, the anchor only executes once, then why is this making such a big difference?

    PFA the exec plans before and after tuning. Scroll down to the CTE part and you ll see the major difference between Before and After is the Concatenation Cost. Why?

    Regards - Yasub

  • Sorry wrong place for this post , please ignore.

  • No replies to this thread please. Direct replies to:http://www.sqlservercentral.com/Forums/Topic1136467-360-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

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