5 ms·
Why are you not using views instead of with clauses?
by ako 7y ago
Why are you not using views instead of with clauses?
- jeffdavis 7y agoCreating views makes more sense sometimes and CTEs make more sense other times. Creating views just for one query is kind of like creating temporary variables for each subexpression. Sure, it works, but not a great solution. Also, other databases do optimize through a CTE. So if you port to PG 11, you might see a lot of regressions in plans unless you rewrite to use views instead. PG 12 will work a lot better for existing queries.