Common Table Expressions (CTE)

Gerald Britton

Why is my CTE so slow?

December 22, 2016 by


Have you ever written up a complex query using Common Table Expressions (CTEs) only to be disappointed by the performance? Have you been blaming the CTE? This article looks at that problem to show that it is a little deeper than a particular syntax choice and offers some tips on how to improve performance.

Read more »
Brian Bønk Rueløkke

Ready, SET, go – How does SQL Server handle recursive CTE’s

August 19, 2016 by

First of all, a quick recap on what a recursive query is.

Recursive queries are useful when building hierarchies, traverse datasets and generate arbitrary rowsets etc. The recursive part (simply) means joining a rowset with itself an arbitrary number of times.

A recursive query is defined by an anchor set (the base rowset of the recursion) and a recursive part (the operation that should be done over the previous rowset).

Read more »