Are there any advantages using
WITH queries instead of simple
SELECT queries using
JOINs performance wise?
I am asking solely about reading data (from catalogues specifically).
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
Postgres can treat queries in the with clause as optimization fences. Meaning that an expensive subquery will not necessarily be recomputed twice when visited. https://www.2ndquadrant.com/en/blog/postgresql-ctes-are-optimization-fences/