Re: Very slow query performance when using CTE - Mailing list pgsql-performance

From Tom Lane
Subject Re: Very slow query performance when using CTE
Date
Msg-id 348393.1743517738@sss.pgh.pa.us
Whole thread Raw
In response to Very slow query performance when using CTE  (Chris Joysn <joysn71@gmail.com>)
List pgsql-performance
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 by date:

Previous
From: Chris Joysn
Date:
Subject: Very slow query performance when using CTE
Next
From: Renan Alves Fonseca
Date:
Subject: Re: Very slow query performance when using CTE