30th September 2021: PostgreSQL 14 Released!

pgbitmap 0.9.3

Posted on 2020-10-25 by pgbitmap
Related Open Source

Announcing the latest Beta release of pgbitmap, available from pgxn and github.

pgbitmap provides a bitmap datatype for Postgres with a full set of functions, operators and aggregates.

This release fixes a number of issues with empty bitmaps and is considered a production release candidate. Any and all feedback is welcomed.

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.

Full documentation is available here