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: buyu zi <zibuyu423(at)gmail(dot)com>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, Nitin Motiani <nitinmotiani(at)google(dot)com>, jdimov(at)a115(dot)bg, 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-05 23:14:10
Message-ID: CA+Y2BmeeJNiK4TZ4Pi-NkEoFg6oA+SfbphoQad8RgUSJFL6aUQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi zibuyu,

Thanks for trying it. I see the same on my side. Planning time in ms
with 550 partial indexes (release builds of master, medians of two
runs):

master v1 v1 + yours
Same key throughout 2.46-2.48 0.85-0.87 0.86-0.92
Two alternating keys 2.43-2.49 2.49-2.56 0.87-0.95
Three alternating keys 2.45-2.51 2.51-2.52 2.46-2.54
All keys distinct 2.43-2.49 2.51-2.52 2.52-2.56
Long keys, distinct 3.79-3.84 4.28-4.34 3.94

So it fixes two alternating keys and cuts the long-key cost. I didn't
see a clear gain with three or four alternating keys, and any fixed
number of entries will have the same edge.

For 19 I'd lean towards keeping v1 as it is, since both reports have
one shared key and it's the smaller change to back-patch. But yours
mostly removes the long-key cost v1 adds, and the other timings were
close, so if others prefer it, I'm happy to fold it in for master.

v1 attached again for cfbot.

Regards,
Ishjaap Singh

Attachment Content-Type Size
v1-0001-Simplify-identical-index-expressions-only-once-in.patch application/octet-stream 7.4 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Abed Alawieh 2026-12-05 23:36:34 Re: BUG #19971: JSON_VALUE RETURNING json drops the quotes of a jsonb string DEFAULT
Previous Message Manu 2026-12-05 22:29:33 Re: BUG #19705: One NaN box makes a BRIN box_inclusion_ops index omit unrelated rows