2 ms·
neat trick! sometimes you absolutely need to materialize your CTE, especially if it is one big computation and you refer it 4-5 times downstream.
by slt2021 3y ago
neat trick!
sometimes you absolutely need to materialize your CTE, especially if it is one big computation and you refer it 4-5 times downstream.
- mulmen 3y agoAccording to the docs [1] this is not necessary: > All queries in the WITH list are computed. These effectively serve as temporary tables that can be referenced in the FROM list. A WITH query that is referenced more than once in FROM is computed only once, unless specified otherwise with NOT MATERIALIZED. [1]: https://www.postgresql.org/docs/15/sql-select.html https://www.postgresql.org/docs/15/sql-select.html