| From: | Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com> |
|---|---|
| To: | Nitin Motiani <nitinmotiani(at)google(dot)com> |
| Cc: | 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-01 00:30:15 |
| Message-ID: | CA+Y2BmdB9Fg=KboKs+gcks0C98eAD_jNZ-tT9X5O8We0EwQtYQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi Nitin,
Thanks for looking. I see the same with a setup like yours. On 19.0
each plan tried to inline full_name() once per index, 550 times, and
each time loaded its body and then gave up, because concat_ws() is
STABLE. With SET search_path on full_name() it gave up before loading
the body. Median planning time in two runs was 2.3 to 2.5 ms on 19.0,
0.8 to 1.0 ms with SET search_path, and 0.7 to 0.9 ms on 18.7.
Your 5 microseconds per index matches what I see with Jordan's f, but
it can grow with the function body. Median planning time in ms with
550 indexes, on 18.7 and 19.0 built the same way:
18.7 19.0
Jordan's f 1.02 3.63
f with 41 copies of j::text 0.78 28.69
same, with SET search_path 0.93 1.24
That works out to about 51 microseconds of additional planning time
per index in the larger-body case. With what Jordan reported about
his application, I think it's worth fixing.
On a fix, both of your ideas aim to skip the second pass when it isn't
needed. Another direction would be to avoid repeating the failed
inlining attempt in the second pass, as stopping it early with SET
search_path removes most of the slowdown. Either way, #19007's case
should stay covered by the tests.
I'm happy to write a patch for whichever way looks better.
Regards,
Ishjaap Singh
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-12-01 00:38:43 | Re: BUG #19947: Rules see parent generated expression instead of routed partition's expression |
| Previous Message | shihao zhong | 2026-12-01 00:15:47 | Re: BUG #19846: dump/restore marks inherited NOT VALID not-null constraint as local |