Skip to content

stannum

Experimental TINQL text search with BM25 and segmented indexes

Overview

PackageVersionCategoryLicenseLanguage
stannum0.1.0FTSAGPL-3.0-or-laterRust
IDExtensionBinLibLoadCreateTrustRelocSchema
2320stannumNoYesNoYesNoNostannum
Relatedtin pg_search

Unreleased 0.1.0-dev snapshot; no version release/tag. Conflicts with tin in the same database. Optional preload enables maintenance workers and standby index reads; preload must match on primary and standbys.

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.1.01817161514stannum-
RPMPIGSTY0.1.01817161514stannum_$v-
DEBPIGSTY0.1.01817161514postgresql-$v-stannum-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64N/AN/AN/A
el8.aarch64N/AN/AN/A
el9.x86_64N/AN/AN/A
el9.aarch64N/AN/AN/A
el10.x86_64N/AN/AN/A
el10.aarch64N/AN/AN/A
d12.x86_64N/AN/AN/A
d12.aarch64
PIGSTY 0.1.0
PIGSTY 0.1.0
N/AN/AN/A
d13.x86_64
PIGSTY 0.1.0
PIGSTY 0.1.0
N/AN/AN/A
d13.aarch64
PIGSTY 0.1.0
PIGSTY 0.1.0
N/AN/AN/A
u22.x86_64
PIGSTY 0.1.0
PIGSTY 0.1.0
N/AN/AN/A
u22.aarch64
PIGSTY 0.1.0
PIGSTY 0.1.0
N/AN/AN/A
u24.x86_64
PIGSTY 0.1.0
PIGSTY 0.1.0
N/AN/AN/A
u24.aarch64
PIGSTY 0.1.0
PIGSTY 0.1.0
N/AN/AN/A
u26.x86_64N/AN/AN/A
u26.aarch64
PIGSTY 0.1.0
PIGSTY 0.1.0
N/AN/AN/A

Build

You can build the RPM / DEB packages for stannum using pig build:

pig build pkg stannum         # build RPM / DEB packages

Install

You can install stannum directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

Install
pig install stannum;          # Install for current active PG version
pig
pig ext install -y stannum -v 18  # PG 18
pig ext install -y stannum -v 17  # PG 17
dnf
dnf install -y stannum_18       # PG 18
dnf install -y stannum_17       # PG 17
apt
apt install -y postgresql-18-stannum   # PG 18
apt install -y postgresql-17-stannum   # PG 17

Create Extension:

CREATE EXTENSION stannum;

Usage

Sources:

stannum is an experimental text-search extension derived from Lead, with persistent indexes, Boolean and phrase queries, and BM25 scoring. The reviewed 0.1.0 source has its own extension identity and storage format.

Core Workflow

CREATE EXTENSION stannum;
CREATE TABLE documents (id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, body text);
INSERT INTO documents (body) VALUES
  ('PostgreSQL supports full text search'), ('Search with exact phrase matching');
CREATE INDEX documents_search ON documents USING stannum (body);
ANALYZE documents;
SELECT id, stannum.full_score(ctid) AS score
FROM documents WHERE body ==> 'search' ORDER BY score DESC LIMIT 10;
SELECT * FROM stannum.segment_info('documents_search');
SELECT * FROM stannum.verify_index('documents_search', heap_check => true);

Operation and Compatibility

The ==> operator accepts TINQL. stannum.highlight marks matching text; stannum.segment_info inspects index segments and stannum.verify_index checks their consistency, optionally against the heap. Index maintenance follows PostgreSQL writes and vacuum.

PostgreSQL 17 and 18 are build targets, with most current lifecycle evidence on 18. A superuser installs the extension in its fixed stannum schema. Primary-server use loads on demand. For standby index reads, add the library to shared_preload_libraries on both primary and standbys and restart those servers.

Migration Boundary

Do not install tin and stannum in the same database: their global ==> operator conflicts. There is no supported in-place migration from the earlier extension names or storage layouts. Treat this as experimental software and validate recovery and maintenance on the intended workload.

Was this page helpful?