Hacker News new | ask | show | jobs
by mwigdahl 1233 days ago
Just tuned a query like this today. Many chained CTEs, joined together at each stage to do range checking logic within subgroups. There were so many self joins that the row estimates (and requested memory grant) were through the roof.

I love CTEs, but the query semantics matter too.