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

2023-11-22 Thread Tom Lane
Jean-Christophe Boggio writes: > 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

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

2023-11-22 Thread Jean-Christophe Boggio
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

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

2023-11-22 Thread Andreas Kretschmer
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

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

2023-11-22 Thread Jean-Christophe Boggio
John, Le 22/11/2023 à 14:30, John Naylor a écrit : Note that "vacuum full" is not recommended practice in most > situations. Among the downsides, it removes the visibility map, > which is necessary to allow index-only scans. Plain vacuum should > always be used except for certain dire

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

2023-11-22 Thread John Naylor
On Wed, Nov 22, 2023 at 6:39 PM Jean-Christophe Boggio wrote: > > Hello, > > I just switched from PG11 to PG15 on our production server (Version is > 15.5). Just made a vacuum full analyze on the DB. Note that "vacuum full" is not recommended practice in most situations. Among the downsides, it

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

2023-11-22 Thread Jean-Christophe Boggio
Hello, I just switched from PG11 to PG15 on our production server (Version is 15.5). Just made a vacuum full analyze on the DB. I have a relatively simple query that used to be fast and is now taking very long (from less than 10 seconds to 3mn+) If I remove a WHERE condition changes the