Hacker News new | ask | show | jobs
by zozbot234 1823 days ago
> They're the database equivalent of pointer-chasing in code.

That's the general case, but more specific CTE queries can be optimized, e.g. by adding database indexes. Recent versions of Postgres have greatly improved wrt. not making CTE's overly inefficient.

1 comments

I said recursive CTEs. CTEs being an optimization barrier is a different issue - and often desirable with Postgres with its lack of optimization hints. Hence with not / materialized etc.