pgsql: Add IntegerSet, to hold large sets of 64-bit ints efficiently. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Add IntegerSet, to hold large sets of 64-bit ints efficiently.
Date
Msg-id E1h7IJt-000237-Ck@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Add IntegerSet, to hold large sets of 64-bit ints efficiently.

The set is implemented as a B-tree, with a compact representation at leaf
items, using Simple-8b algorithm, so that clusters of nearby values use
less memory.

The IntegerSet isn't used for anything yet, aside from the test code, but
we have two patches in the works that would benefit from this: A patch to
allow GiST vacuum to delete empty pages, and a patch to reduce heap
VACUUM's memory usage, by storing the list of dead TIDs more efficiently
and lifting the 1 GB limit on its size.

This includes a unit test module, in src/test/modules/test_integerset.
It can be used to verify correctness, as a regression test, but if you run
it manully, it can also print memory usage and execution time of some of
the tests.

Author: Heikki Linnakangas, Andrey Borodin
Reviewed-by: Julien Rouhaud
Discussion: https://www.postgresql.org/message-id/b5e82599-1966-5783-733c-1a947ddb729f@iki.fi

Branch
------
master

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

Modified Files
--------------
src/backend/lib/Makefile                           |    2 +-
src/backend/lib/README                             |    2 +
src/backend/lib/integerset.c                       | 1019 ++++++++++++++++++++
src/include/lib/integerset.h                       |   24 +
src/test/modules/Makefile                          |    1 +
src/test/modules/test_integerset/.gitignore        |    4 +
src/test/modules/test_integerset/Makefile          |   21 +
src/test/modules/test_integerset/README            |    7 +
.../test_integerset/expected/test_integerset.out   |   14 +
.../test_integerset/sql/test_integerset.sql        |   11 +
.../test_integerset/test_integerset--1.0.sql       |    8 +
src/test/modules/test_integerset/test_integerset.c |  622 ++++++++++++
.../test_integerset/test_integerset.control        |    4 +
13 files changed, 1738 insertions(+), 1 deletion(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Collations with nondeterministic comparison
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix bug in the GiST vacuum's 2nd stage.