pgfaceting
pgfaceting
pgfaceting : fast faceting queries using an inverted index
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3580 | pgfaceting
|
pgfaceting
|
0.2.0 |
TYPE
|
BSD 3-Clause
|
SQL
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
----d--
|
No
|
No
|
No
|
Yes
|
no
|
no
|
| Relationships | |
|---|---|
| Schemas | faceting |
| Requires | roaringbitmap
|
| See Also | pg_trgm
rum
prefix
semver
unit
pgpdf
pglite_fusion
md5hash
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED
|
0.2.0 |
18
17
16
15
14
|
pgfaceting |
roaringbitmap |
| RPM | PIGSTY
|
0.2.0 |
18
17
16
15
14
|
pgfaceting_$v |
- |
| DEB | PGDG
|
0.2.0 |
18
17
16
15
14
|
postgresql-$v-pgfaceting |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
el8.aarch64
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
el9.x86_64
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
el9.aarch64
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
PIGSTY 0.2.0
|
el10.x86_64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
el10.aarch64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
d12.x86_64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
d12.aarch64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
d13.x86_64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
d13.aarch64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
u22.x86_64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
u22.aarch64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
u24.x86_64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
u24.aarch64
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
PGDG 0.2.0
|
Source
pig build pkg pgfaceting; # build rpmInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pgfaceting; # install via package name, for the active PG version
pig install pgfaceting -v 18; # install for PG 18
pig install pgfaceting -v 17; # install for PG 17
pig install pgfaceting -v 16; # install for PG 16
pig install pgfaceting -v 15; # install for PG 15
pig install pgfaceting -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION pgfaceting CASCADE; -- requires roaringbitmapUsage
pgfaceting: fast faceted search using inverted indexes with roaring bitmaps
The pgfaceting extension enables rapid facet counting via inverted indexes built with roaring bitmaps. Requires the pg_roaringbitmap extension.
CREATE EXTENSION pgfaceting;Facet Types
plain_facet(column): Use column values directly as facetsdatetrunc_facet(column, precision): Apply date truncation (e.g., monthly/yearly buckets)bucket_facet(column, buckets): Assign continuous variables to predefined ranges
Key Functions
-- Create facet infrastructure for a table
SELECT pgfaceting.add_faceting_to_table(
'products',
'id',
ARRAY[
plain_facet('color'),
plain_facet('size'),
bucket_facet('price', ARRAY[0, 10, 50, 100, 500])
]
);
-- Run maintenance to merge incremental changes
SELECT pgfaceting.run_maintenance();
-- Merge deltas for a specific table
SELECT pgfaceting.merge_deltas('products');
-- Get top N facet values
SELECT pgfaceting.top_values('products', 10);
-- Count results with facet filters
SELECT pgfaceting.count_results('products', filters);Architecture
The extension maintains two auxiliary tables per indexed table: a main facets table with roaring bitmaps mapping facet values to row IDs, and a delta table for incremental changes between maintenance runs.
Currently supports only 32-bit integer ID columns.
Last updated on