biscuit
pg_biscuit : IAM-LIKE pattern matching with bitmap indexing
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2170 | biscuit | pg_biscuit | 2.2.2 | FTS | MIT | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | public |
| Requires | plpgsql |
| See Also | hll rum pg_textsearch |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 2.2.2 | 18 17 16 15 14 | pg_biscuit | plpgsql |
| RPM | PIGSTY | 2.2.2 | 18 17 16 15 14 | pg_biscuit_$v | - |
| DEB | PIGSTY | 2.2.2 | 18 17 16 15 14 | postgresql-$v-biscuit | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
el8.aarch64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
el9.x86_64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
el9.aarch64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
el10.x86_64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
el10.aarch64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
d12.x86_64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
d12.aarch64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
d13.x86_64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
d13.aarch64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
u22.x86_64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
u22.aarch64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
u24.x86_64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
u24.aarch64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
u26.x86_64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
u26.aarch64 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | PIGSTY 2.2.2 | MISS | MISS |
Source
pig build pkg pg_biscuit; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_biscuit; # install via package name, for the active PG version
pig install biscuit; # install by extension name, for the current active PG version
pig install biscuit -v 18; # install for PG 18
pig install biscuit -v 17; # install for PG 17
pig install biscuit -v 16; # install for PG 16Create this extension with:
CREATE EXTENSION biscuit CASCADE; -- requires plpgsqlUsage
Syntax:
CREATE EXTENSION biscuit; CREATE INDEX idx_users_name ON users USING biscuit(name); SELECT * FROM users WHERE name LIKE '%john%';
biscuit is a PostgreSQL index access method for fast LIKE and ILIKE pattern matching, including multi-column searches. The upstream project positions it as a deterministic bitmap index that avoids the false-positive recheck overhead common in trigram-based searches.
Quick Start
Create the extension and build a Biscuit index on one or more text columns:
CREATE EXTENSION biscuit;
CREATE INDEX idx_users_name ON users USING biscuit(name);
CREATE INDEX idx_products_search
ON products USING biscuit(name, description, category);Basic wildcard queries work with the index:
SELECT * FROM users WHERE name LIKE '%john%';
SELECT * FROM users WHERE name NOT LIKE 'a%b%c';
SELECT COUNT(*) FROM users WHERE name LIKE '%test%';
SELECT *
FROM products
WHERE name LIKE '%widget%'
AND description LIKE '%blue%'
AND category LIKE 'electronics%'
LIMIT 10;Index Behavior
Biscuit stores bitmap position indexes for each string and can match both forward and backward character positions. The upstream design highlights:
- positive indexes for characters at exact positions
- negative indexes for characters counted from the string end
- case-insensitive variants for
ILIKE - exact-length and minimum-length bitmaps for fast length filtering
For a pattern such as LIKE 'abc%def', Biscuit can intersect prefix and suffix bitmaps plus a minimum-length filter, producing exact matches without a heap recheck phase.
Pattern Cases
The implementation documents optimized paths for common pattern types:
- exact matches such as
'abc' - prefix patterns such as
'abc%' - suffix patterns such as
'%xyz' - substring patterns such as
'%abc%' - multi-column predicates, where Biscuit reorders predicates by estimated selectivity
Performance Notes
The upstream README emphasizes bitmap-only evaluation and several execution optimizations, including:
- early termination when an intermediate bitmap becomes empty
- direct use of roaring bitmaps for sparse and dense cases
- negative-position lookups for suffix predicates
- sorted TID output to improve heap access locality
- special handling for aggregate queries and
LIMIT
The project README also includes a benchmark setup comparing Biscuit indexes with trigram-based approaches on a 1M-row table.
Requirements
The current upstream README lists these requirements for source builds:
- PostgreSQL 16 or newer
- standard build tools such as
gcc,make, andpg_config - optional CRoaring for improved performance
The project publishes packages on PGXN and maintains a dedicated documentation site on Read the Docs.