Re: Postgres: Queries are too slow after upgrading to PG17 from PG15

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Sajith Prabhakar Shetty <ssajith(at)blackduck(dot)com>
Cc: Andrei Lepikhov <lepihov(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Postgres: Queries are too slow after upgrading to PG17 from PG15
Date: 2025-07-30 18:45:39
Message-ID: CAH2-WzknRnYgiaOtOg9XyPec6FmA5PkbwneU5HsdGhxKmutRmg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jul 28, 2025 at 4:41 PM Peter Geoghegan <pg(at)bowt(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Merlin Moncure 2025-07-30 18:58:55 Re: Postgres: Queries are too slow after upgrading to PG17 from PG15
Previous Message vignesh C 2025-07-30 10:54:04 Re: BUG #18988: DROP SUBSCRIPTION locks not-yet-accessed database