roaringbitmap
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_roaringbitmap | 1.2.0 | TYPE | Apache-2.0 | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3630 | roaringbitmap | No | Yes | No | Yes | No | Yes | - |
| Related | hll rum pgfaceting pg_search bloom pg_textsearch pg_bestmatch vchord_bm25 pg_fts |
|---|---|
| Depended By | pgfaceting |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 1.2.0 | 1817161514 | pg_roaringbitmap | - |
| RPM | PGDG | 1.2.0 | 1817161514 | pg_roaringbitmap_$v | - |
| DEB | PGDG | 1.2.0 | 1817161514 | postgresql-$v-roaringbitmap | - |
Build
You can build the RPM packages for pg_roaringbitmap using pig build:
Install
You can install pg_roaringbitmap directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
pg_roaringbitmap installs the PostgreSQL extension roaringbitmap, which provides compressed bitmap types and set-operation functions backed by Roaring Bitmaps. Use it for compact integer-set storage, fast unions/intersections, cohort filters, faceting, and bitmap aggregation.
v1.2.0 adds rb_runoptimize() / rb64_runoptimize() to shrink bitmap binary size, preserves the legacy rb_exsit spelling for backward compatibility, adds PostgreSQL 19 compatibility, and validates untrusted bitmap input in receive functions.
Create the Extension
roaringbitmap.output_format can be bytea or array. The default output format is bytea, which is better for large bitmaps; array is easier to read interactively.
Data Types
roaringbitmapstores unsigned 32-bit integer sets over the logical range[0, 4294967296).roaringbitmap64stores unsigned 64-bit integer sets and uses therb64_function family.
Build and Convert
For 64-bit values, use rb64_build(), rb64_build_agg(), rb64_to_array(), and rb64_iterate().
Set Operations
Containment and overlap operators are available:
Cardinality and Range Helpers
The 64-bit range helpers use the rb64_ prefix. Since v1.1.0, range_end = 0 means unlimited for several rb64_ range/select functions.
Aggregate Functions
Optimize Serialized Size
rb_runoptimize() and rb64_runoptimize() can reduce serialized bitmap size for suitable data distributions. Measure before using them in hot write paths.
Caveats
- Pigsty uses extension file name
roaringbitmap.md; the upstream package name ispg_roaringbitmap. - Source builds require PostgreSQL headers and CRoaring dependencies. The README notes regression testing before release covers PostgreSQL 13 and above.
Makefile_nativecan compile with SIMD instructions and may be faster on matching CPUs, but binaries built that way can crash withSIGILLon machines without the required CPU features.- Use
byteaoutput for large bitmaps andarrayoutput for human inspection.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)