Are there any advantages using WITH
queries instead of simple SELECT
queries using JOIN
s 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 communityPostgres 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/
DEFAULT
and sequences specifically) tomorrow. I am more used to get the information from the nativepg_cataolg
and build up queries as neccesary from there. I have no clue how queries will be efficient using (the views(?) provided for the ANSI information schema) might impact the performance.