| From: | James Coleman <jtc331(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Binary search in ScalarArrayOpExpr for OR'd constant arrays |
| Date: | 2020-04-21 01:27:34 |
| Message-ID: | CAAaqYe8x62+=wn0zvNKCj55tPpg-JBHzhZFFc6ANovdqFw7-dA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Over in "execExprInterp() questions / How to improve scalar array op
expr eval?" [1] I'd mused about how we might be able to optimized
scalar array ops with OR'd semantics.
This patch implements a binary search for such expressions when the
array argument is a constant so that we can avoid needing to teach
expression execution to cache stable values or know when a param has
changed.
The speed-up for the target case can pretty impressive: in my
admittedly contrived and relatively unscientific test with a query in
the form:
select count(*) from generate_series(1,100000) n(i) where i in (<1000
random integers in the series>)
shows ~30ms for the patch versus ~640ms on master.
James
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Binary-search-const-arrays-in-OR-d-ScalarArrayOps.patch | text/x-patch | 15.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2020-04-21 01:38:32 | Re: Fix for pg_statio_all_tables |
| Previous Message | Alexander Korotkov | 2020-04-20 23:44:45 | Fix for pg_statio_all_tables |