Skip to content

tin

TIN-compatible text search for development and testing

lead : TIN-compatible text search for development and testing

Overview

ID Extension Package Version Category License Language
2310 tin lead 1.0.6 FTS AGPL-3.0-or-later Rust
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-- No Yes No Yes no no
Relationships
Schemas tin
See Also stannum pg_search
Untagged 1.0.6 source snapshot for development/CI, not production PlanetScale TIN. Conflicts with stannum in the same database.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 1.0.6 18 17 16 15 14 lead -
RPM PIGSTY 1.0.6 18 17 16 15 14 lead_$v -
DEB PIGSTY 1.0.6 18 17 16 15 14 postgresql-$v-lead -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
el8.aarch64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
el9.x86_64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
el9.aarch64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
el10.x86_64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
el10.aarch64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
d12.x86_64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
d12.aarch64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
d13.x86_64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
d13.aarch64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
u22.x86_64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
u22.aarch64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
u24.x86_64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
u24.aarch64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
u26.x86_64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
u26.aarch64 PIGSTY 1.0.6 PIGSTY 1.0.6 N/A N/A N/A
Package Version OS ORG SIZE File URL
lead_18 1.0.6 el8.x86_64 pigsty 2.3 MiB lead_18-1.0.6-1PGSTY.el8.x86_64.rpm
lead_18 1.0.6 el8.aarch64 pigsty 2.0 MiB lead_18-1.0.6-1PGSTY.el8.aarch64.rpm
lead_18 1.0.6 el9.x86_64 pigsty 2.3 MiB lead_18-1.0.6-1PGSTY.el9.x86_64.rpm
lead_18 1.0.6 el9.aarch64 pigsty 2.2 MiB lead_18-1.0.6-1PGSTY.el9.aarch64.rpm
lead_18 1.0.6 el10.x86_64 pigsty 2.3 MiB lead_18-1.0.6-1PGSTY.el10.x86_64.rpm
lead_18 1.0.6 el10.aarch64 pigsty 2.2 MiB lead_18-1.0.6-1PGSTY.el10.aarch64.rpm
postgresql-18-lead 1.0.6 d12.x86_64 pigsty 1.9 MiB postgresql-18-lead_1.0.6-1PGSTY~bookworm_amd64.deb
postgresql-18-lead 1.0.6 d12.aarch64 pigsty 1.7 MiB postgresql-18-lead_1.0.6-1PGSTY~bookworm_arm64.deb
postgresql-18-lead 1.0.6 d13.x86_64 pigsty 1.9 MiB postgresql-18-lead_1.0.6-1PGSTY~trixie_amd64.deb
postgresql-18-lead 1.0.6 d13.aarch64 pigsty 1.7 MiB postgresql-18-lead_1.0.6-1PGSTY~trixie_arm64.deb
postgresql-18-lead 1.0.6 u22.x86_64 pigsty 2.2 MiB postgresql-18-lead_1.0.6-1PGSTY~jammy_amd64.deb
postgresql-18-lead 1.0.6 u22.aarch64 pigsty 2.1 MiB postgresql-18-lead_1.0.6-1PGSTY~jammy_arm64.deb
postgresql-18-lead 1.0.6 u24.x86_64 pigsty 2.2 MiB postgresql-18-lead_1.0.6-1PGSTY~noble_amd64.deb
postgresql-18-lead 1.0.6 u24.aarch64 pigsty 2.1 MiB postgresql-18-lead_1.0.6-1PGSTY~noble_arm64.deb
postgresql-18-lead 1.0.6 u26.x86_64 pigsty 2.1 MiB postgresql-18-lead_1.0.6-1PGSTY~resolute_amd64.deb
postgresql-18-lead 1.0.6 u26.aarch64 pigsty 2.0 MiB postgresql-18-lead_1.0.6-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
lead_17 1.0.6 el8.x86_64 pigsty 2.3 MiB lead_17-1.0.6-1PGSTY.el8.x86_64.rpm
lead_17 1.0.6 el8.aarch64 pigsty 2.0 MiB lead_17-1.0.6-1PGSTY.el8.aarch64.rpm
lead_17 1.0.6 el9.x86_64 pigsty 2.3 MiB lead_17-1.0.6-1PGSTY.el9.x86_64.rpm
lead_17 1.0.6 el9.aarch64 pigsty 2.2 MiB lead_17-1.0.6-1PGSTY.el9.aarch64.rpm
lead_17 1.0.6 el10.x86_64 pigsty 2.3 MiB lead_17-1.0.6-1PGSTY.el10.x86_64.rpm
lead_17 1.0.6 el10.aarch64 pigsty 2.2 MiB lead_17-1.0.6-1PGSTY.el10.aarch64.rpm
postgresql-17-lead 1.0.6 d12.x86_64 pigsty 1.9 MiB postgresql-17-lead_1.0.6-1PGSTY~bookworm_amd64.deb
postgresql-17-lead 1.0.6 d12.aarch64 pigsty 1.7 MiB postgresql-17-lead_1.0.6-1PGSTY~bookworm_arm64.deb
postgresql-17-lead 1.0.6 d13.x86_64 pigsty 1.9 MiB postgresql-17-lead_1.0.6-1PGSTY~trixie_amd64.deb
postgresql-17-lead 1.0.6 d13.aarch64 pigsty 1.7 MiB postgresql-17-lead_1.0.6-1PGSTY~trixie_arm64.deb
postgresql-17-lead 1.0.6 u22.x86_64 pigsty 2.2 MiB postgresql-17-lead_1.0.6-1PGSTY~jammy_amd64.deb
postgresql-17-lead 1.0.6 u22.aarch64 pigsty 2.0 MiB postgresql-17-lead_1.0.6-1PGSTY~jammy_arm64.deb
postgresql-17-lead 1.0.6 u24.x86_64 pigsty 2.2 MiB postgresql-17-lead_1.0.6-1PGSTY~noble_amd64.deb
postgresql-17-lead 1.0.6 u24.aarch64 pigsty 2.0 MiB postgresql-17-lead_1.0.6-1PGSTY~noble_arm64.deb
postgresql-17-lead 1.0.6 u26.x86_64 pigsty 2.1 MiB postgresql-17-lead_1.0.6-1PGSTY~resolute_amd64.deb
postgresql-17-lead 1.0.6 u26.aarch64 pigsty 2.0 MiB postgresql-17-lead_1.0.6-1PGSTY~resolute_arm64.deb

Source

pig build pkg lead;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

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

Install this extension with pig:

pig install lead;		# install via package name, for the active PG version
pig install tin;		# install by extension name, for the current active PG version

pig install tin -v 18;   # install for PG 18
pig install tin -v 17;   # install for PG 17

Create this extension with:

CREATE EXTENSION tin;

Usage

Sources:

tin is the extension name of Lead, a TIN-compatible text-search implementation for development, CI, and staging. The reviewed 1.0.6 source snapshot deliberately trades performance for a small reference implementation and is unsuitable for production search.

Core Workflow

CREATE EXTENSION tin;
CREATE TABLE documents (id integer, body text);
INSERT INTO documents VALUES (1, 'craft beer'), (2, 'wine'), (3, 'beer festival');
CREATE INDEX documents_search ON documents USING tin (body);
SELECT id, tin.full_score(ctid) AS score
FROM documents WHERE body ==> 'beer' ORDER BY score DESC;

Objects and Behavior

The tin access method and ==> operator evaluate TINQL predicates. tin.score, tin.full_score, tin.max_score, and tin.score_inspect expose scoring; tin.highlight and tin.highlight_ansi mark matches. Scoring calls bind to the matching search expression and index.

Every index scan returns all heap pages as lossy candidates. PostgreSQL rechecks the visible tuples, expressions, and partial-index predicates. The index stores no search data; scoring may rescan visible heap rows. This preserves query semantics without providing a production inverted index.

Requirements

The reviewed source targets PostgreSQL 17 and 18. Installation requires a superuser; objects use the fixed tin schema. The library loads on demand and needs no preload or restart. Keep realistic data volumes in mind when using it in tests.

PlanetScale documents TIN as its production search implementation and Lead as the local development substitute. Both use the canonical extension name tin; this catalog entry tracks the open-source Lead implementation. Its source-snapshot version is not a claim about the version deployed by PlanetScale.

The current source adds a trailing stemmer argument to tin.tokenize, tin.ql_parse, tin.highlight, and tin.highlight_ansi, while keeping the earlier signatures under names ending in _v1_0_3. Changing an index’s stemmer requires REINDEX. A score call must be at the same query level as its matching ==> predicate.