I’m currently working with a client where Postgres is used as the data
warehouse DB. One of Postgres’ features is that CTEs in queries, i.e.
WITH subquery AS ( SELECT ... ) act as ‘optimisation fences’, meaning
that, if you reference subquery later i...