Introduce bms_offset_members() function

Effectively, a function to bitshift members by the specified number of
bits.  We have various fragments of code doing this manually with a
bms_next_member() -> bms_add_member() loop.  We can do this more
efficiently in terms of CPU and memory allocation by making a new
Bitmapset and bitshifting in the words of the old set to populate it.

Author: David Rowley <[email protected]>
Reviewed-by: Chao Li <[email protected]>
Reviewed-by: Greg Burd <[email protected]>
Discussion: 
https://postgr.es/m/CAApHDvq=eedw2qp+aszsottse+h0fnvq55cctnqbkldyirz...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bb7ded1eebed708865d9bb0a3513c7ed3afe7065

Modified Files
--------------
src/backend/nodes/bitmapset.c                      | 135 +++++++++++++++++++++
src/backend/optimizer/plan/setrefs.c               |  10 +-
src/backend/optimizer/prep/prepjointree.c          |  30 ++---
src/backend/rewrite/rewriteManip.c                 |  25 +---
src/backend/statistics/extended_stats.c            |  12 +-
src/include/nodes/bitmapset.h                      |   1 +
.../test_bitmapset/expected/test_bitmapset.out     |  81 +++++++++++++
.../modules/test_bitmapset/sql/test_bitmapset.sql  |  23 ++++
.../modules/test_bitmapset/test_bitmapset--1.0.sql |   8 ++
src/test/modules/test_bitmapset/test_bitmapset.c   | 101 ++++++++++++++-
10 files changed, 374 insertions(+), 52 deletions(-)

Reply via email to