Re: Postgres: Queries are too slow after upgrading to PG17 from PG15 - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: Postgres: Queries are too slow after upgrading to PG17 from PG15
Date
Msg-id CAH2-WzknRnYgiaOtOg9XyPec6FmA5PkbwneU5HsdGhxKmutRmg@mail.gmail.com
Whole thread Raw
In response to Re: Postgres: Queries are too slow after upgrading to PG17 from PG15  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-bugs
On Mon, Jul 28, 2025 at 4:41 PM Peter Geoghegan <pg@bowt.ie> wrote:
> The query takes ~1550ms on my local workstation. If I just comment out
> the relevant qsort, it'll take only ~190 ms. That qsort might not be
> the only problem here, but it is the immediate problem. Note that
> commenting out the qsort should produce the same answer, at least for
> this one query, since the constants that appear in the query are
> already sorted (the EXPLAIN row counts match what they show with the
> qsort in place).

Actually, that isn't quite true -- the constants weren't in sorted order.

I find that if I presort the elements within the query text itself,
the runtime goes down to only ~410ms. That's still not great, but it
is a vast improvement.

--
Peter Geoghegan



pgsql-bugs by date:

Previous
From: vignesh C
Date:
Subject: Re: BUG #18988: DROP SUBSCRIPTION locks not-yet-accessed database
Next
From: Merlin Moncure
Date:
Subject: Re: Postgres: Queries are too slow after upgrading to PG17 from PG15