Announcing the new Beta release of pgbitmap, available from pgxn.
pgbitmap provides a bitmap datatype for postgres with a full set of
functions and operators.
A bitmap is an array of bits, indexed by an integer. Bitmaps provide
an efficient means to implement sets of integers. pgbitmap provides
functions and operators for:
- creating new bitmaps;
- adding elements to bitmaps;
- removing elements from bitmaps;
- testing for inclusion of elements in bitmaps;
- finding the minimum and maximum bits in bitmaps;
- unioning bitmaps together (set union/logical or);
- intersecting bitmaps (set intersection/logical and);
- subtracting one bitmap from another;
- converting bitmaps to and from textual representations;
- converting bitmaps to and from arrays;
- aggregating bits, and bitmaps, into bitmaps.
It differs from the standard Postgres bitstring in that it isn't based
around bit zero (bitmap(1000000) does not contain 1,000,000 zeroes
followed by a 1) and it has more functionality.
It was developed primarily in order to efficiently manage sets of
privileges for Virtual Private Database implementations.