Re: Performance degradation with CTEs, switching from PG 11 to PG 15

From: Jean-Christophe Boggio <postgresql(at)thefreecat(dot)org>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Performance degradation with CTEs, switching from PG 11 to PG 15
Date: 2023-11-22 15:58:01
Message-ID: 620b9acb-1989-43a3-839e-ff7286cebfe2@thefreecat.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Andreas,

Le 22/11/2023 à 15:25, Andreas Kretschmer a écrit :
> Am 22.11.23 um 12:38 schrieb Jean-Christophe Boggio: >> Also, adding "materialized" to both "withcwrack" and "withcwrack0"
>> CTEs gets the result in acceptable timings (a few seconds). The >>
problem with this is that we have some clients with older versions >> of
PG and I guess blindly adding the "materialized" keyword will >> cause
errors. > yeah, prior to 11 CTEs are a optimizer barrier. You can try to
> rewrite the queries to not using CTEs - or upgrade. If i were you i >
would upgrade.
I did upgrade :-) But we have many users for which we don't decide on
when they do upgrade so we have to keep compatibility with most versions
of PG and in that particular case (non-existence of the materialized
keyword for PG 11 and before) it is a real problem.

Best regards,

JC

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2023-11-22 16:07:28 Re: Performance degradation with CTEs, switching from PG 11 to PG 15
Previous Message Andreas Kretschmer 2023-11-22 14:25:11 Re: Performance degradation with CTEs, switching from PG 11 to PG 15