From: | David Rowley <drowley(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Don't use bms_membership() in cases where we don't need to |
Date: | 2023-11-27 21:42:06 |
Message-ID: | E1r7jMk-007YrK-44@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Don't use bms_membership() in cases where we don't need to
00b41463c adjusted Bitmapset so that an empty set is always represented
as NULL. This makes checking for empty sets far cheaper than it used
to be.
There were various places in the code where we'd call bms_membership()
to handle the 3 possible BMS_Membership values. For the BMS_SINGLETON
case, we'd also call bms_singleton_member() to find the single set member.
This can now be done in a more optimal way by first checking if the set is
NULL and then not bothering with bms_membership() and simply call
bms_get_singleton_member() instead to find the single member. This
function will return false if there are multiple members in the set.
Here we also tidy up some logic in examine_variable() for the single
member case. There's now no need to call bms_is_member() as we've
already established that we're working with a singleton Bitmapset, so we
can just check if varRelid matches the singleton member.
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/CAApHDvqW+CxNPcY245GaWiuqkkqgTudtG2ncGvvSjGn2wdTZLA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/930d2b442ff12e6d466a8c62cecdf3f17680aa3e
Modified Files
--------------
src/backend/optimizer/plan/initsplan.c | 32 ++++++++++++++------------
src/backend/utils/adt/selfuncs.c | 42 ++++++++++++++++++----------------
2 files changed, 39 insertions(+), 35 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2023-11-27 23:36:26 | pgsql: Add CHECK_FOR_INTERRUPTS() in scram_SaltedPassword() for the bac |
Previous Message | Andrew Dunstan | 2023-11-27 20:38:24 | Re: pgsql: meson: docs: Add {html,man} targets, rename install-doc-* |