Comment by gmfawcett
4 years ago
Not all database systems can optimize queries well over CTE boundaries. I believe this is still true for PostgreSQL (no longer true, see below -- it was true a few years ago). So there's a potential performance hit for (the otherwise excellent advice of) writing with CTE's.
IRC tells me this has been fixed now.
Awesome news! thank you for sharing this. I found this post which confirms IRC and suggests it was an improvement in PG 12:
https://paquier.xyz/postgresql-2/postgres-12-with-materializ...
Today is a great day to have been wrong on the Internet. :)