Feb 07 2012

Avoiding Bad Query Performance

There’s a very old saying, “When you find yourself in a hole, stop digging.”

And my evidence today is:

Hairy

That’s certainly not the hairiest execution plan I’ve seen. In some ways, it’s not all that horrible. But it sure is evidence that someone was down in a hole and they were working that shovel hard.

If you’re interested, most of the operators are scans against a table variable that’s 11 million rows deep. There are also table spools chugging away in there. And the select statement only returns 1500 rows.

Please, stop digging.

6 Comments

  • By Colleen Morrow, February 7, 2012 @ 9:09 am

    On the bright side, it’s a worthy addition to Brent’s collection of execution plans as art.

  • By Grant Fritchey, February 7, 2012 @ 10:22 am

    Ha! Yeah, it’s somewhat “pretty”

  • By Paul Brewer, February 10, 2012 @ 6:07 am

    It looks like a double helix DNA genome!

  • By Tracy McKibben (RealSQLGuy), February 14, 2012 @ 7:33 am

    I smell recursion…

  • By John Miner, February 14, 2012 @ 2:12 pm

    That is a work of art! I wonder what the TSQL looks like … I always stick with the keep it simple stupid (KISS) principle.

Other Links to this Post

  1. Avoiding Bad Query Performance | Database, Performance | Syngu — February 8, 2012 @ 1:43 am

RSS feed for comments on this post. TrackBack URI

Leave a comment