1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Add bms_get_singleton_member(), and use it where appropriate.

This patch adds a function that replaces a bms_membership() test followed
by a bms_singleton_member() call, performing both the test and the
extraction of a singleton set's member in one scan of the bitmapset.
The performance advantage over the old way is probably minimal in current
usage, but it seems worthwhile on notational grounds anyway.

David Rowley
This commit is contained in:
Tom Lane
2014-11-28 14:16:24 -05:00
parent f4e031c662
commit d25367ec4f
5 changed files with 52 additions and 7 deletions

View File

@ -867,9 +867,8 @@ generate_base_implied_equalities_no_const(PlannerInfo *root,
int relid;
Assert(!cur_em->em_is_child); /* no children yet */
if (bms_membership(cur_em->em_relids) != BMS_SINGLETON)
if (!bms_get_singleton_member(cur_em->em_relids, &relid))
continue;
relid = bms_singleton_member(cur_em->em_relids);
Assert(relid < root->simple_rel_array_size);
if (prev_ems[relid] != NULL)