Fwd: Very slow query performance when using CTE

Поиск
Список
Период
Сортировка
От Chris Joysn
Тема Fwd: Very slow query performance when using CTE
Дата
Msg-id CAKRYhW1RwatKHzsYFXMjLUOcTONi1ZcLy6NAz12O6HwZQ7Rn7w@mail.gmail.com
обсуждение исходный текст
Ответ на Very slow query performance when using CTE  (Chris Joysn <joysn71@gmail.com>)
Список pgsql-performance
unfortunately that increased the query execution time by a factor of 8:


On Tue, 1 Apr 2025 at 16:28, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Chris Joysn <joysn71@gmail.com> writes:
> I have an issue when using CTEs. A query, which consists of multiple CTEs,
> runs usually rather fast (~5s on my environment). But it turned out that
> using one CTE can lead to execution times of up to one minute.
> That CTE is used two times within the query.

Try labeling that CTE as NOT MATERIALIZED.

                        regards, tom lane

В списке pgsql-performance по дате отправления: