Re: BUG #19936: Planning is slower on 19.0 with many partial indexes on a SQL function

From: Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com>
To: Jordan Dimov <jdimov(at)a115(dot)co(dot)uk>, buyu zi <zibuyu423(at)gmail(dot)com>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, Nitin Motiani <nitinmotiani(at)google(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, guofenglinux(at)gmail(dot)com
Subject: Re: BUG #19936: Planning is slower on 19.0 with many partial indexes on a SQL function
Date: 2026-12-06 16:25:35
Message-ID: CA+Y2BmdvnsAAF3fxLorhAhFG3FHFCjQ+f9hQc3TzXcL-6hy44Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi zibuyu,

Thanks for v2, and thanks Jordan for testing it on the real schema.
I tested v2 on master and REL_19_STABLE.

Planning time in ms on master, median of 21 plans in two rounds,
release builds, 550 partial indexes on one table:

master v1 v2
same key 2.68 0.87-1.00 0.84-0.89
2 keys alternating 2.47-2.67 2.52-2.56 0.92-0.95
12 keys, round robin 2.48-2.72 2.61-2.65 0.93-0.96
12 keys, random order 2.52-2.62 2.41 0.90-0.94
all keys distinct 2.52-2.68 2.63-2.64 2.60
long keys, distinct 3.80-4.10 4.29-4.38 3.87-3.95

So v2 covers the interleaved layouts, and it brings the long-key case,
where v1 was a bit slower, back close to master. Plans were the same
on all three builds.

make check passes on both branches, and the predicate tests pass with
debug_discard_caches = 1. On my REL_19_STABLE x86-64 build,
RelationData has the same size with and without the patch, and the
offsets I checked didn't move, so the new field fits in padding there.

Since the slowdown is new in 19, I think this should go into
REL_19_STABLE as well; v2 applies there cleanly. zibuyu, if you have a
community account, I'm happy to add you as an author on the
commitfest entry: https://commitfest.postgresql.org/patch/7769/

v2 looks good from my testing.

Regards,
Ishjaap Singh

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Michael Banck 2026-12-06 16:09:25 Re: reltuples kept decreasing with each autovacuum run Re: BUG #18773