pg-smart-search Documentation
High-performance Search SDK for PostgreSQL. Parallel/hedged search strategies, smart fallbacks, and zero extra infrastructure. Replace ElasticSearch with pure Postgres.
pg-smart-search Documentation
Database sovereignty shouldn't mean sacrificing search quality. pg-smart-search brings parallel, typo-tolerant search to PostgreSQL without needing ElasticSearch or Meilisearch.
🚀 Version 2.0.0 is out! — released 2026-07-27
Critical fix: The npm run init wizard was generating invalid SQL for every ADVANCED-tier user
(USING RUM (col rum_trgm_ops) — an operator class that doesn't exist). Now fixed to the correct
USING GIN (col gin_trgm_ops).
What's new:
- Real concurrent benchmark suite (
npm run bench:real) — 1M rows, 550 unique queries, percentiles p50/p95/p99 - EXPLAIN plan capture (
npm run bench:explain) for index tuning - GIN-first trigram indexing by default
- 7 correctness fixes (cache write bug,
cacheHitRateformula, cursor on relevance-sorted search, Gemini key exposure, retry classification, zombie query race, in-flight deduplication) - 149/149 tests passing
Cold search @ 1M rows: 5.9ms avg · 9.3ms p95 · 170 req/s (1 worker) · 1 208 req/s (8 workers)
Hot cache: 0.057ms avg · 17 377 req/s (1 worker) · 22 649 req/s (8 workers)
Quick Start
Get running in 3 minutes
Core Concepts
Understand the Parallel Fast-Track
API Reference
Explore the SDK methods
Deploy to Prod
Security, Metrics, and Reliability
The Golden Mean
- Faster than ILIKE: Uses GIN/GiST indices and parallel hedged execution strategies.
- Cheaper than ES: $0 extra infrastructure if you already use PostgreSQL.
- Smarter than standard SQL: Handles typos, keyboard layout issues, and relevance ranking (
ts_rank/word_similarity) out of the box.