pg-smart-search
Core Concepts

Search Tiers

Understand the LITE, STANDARD, ADVANCED, and VECTOR search tiers in pg-smart-search and how they scale with your data.

Search Tiers

Search performance heavily depends on how your database is indexed. pg-smart-search categorizes search capabilities into four tiers based on dataset size and required indices.

Tier Overview

TierDataset SizeEngine FeaturesIndices Required
LITE< 100k rowsBasic ILIKENone
STANDARD100k - 1M rowsHedged FTS + ILIKE/trigramGIN (FTS) + GiST/GIN (trigram)
ADVANCED> 1M rowsword_similarity rankingGiST/GIN pg_trgm (not RUM)
VECTORSemanticOpenAI/Gemini + pgvector (HNSW)pgvector HNSW

The CLI's ADVANCED-tier setup still generates a CREATE EXTENSION rum / USING RUM index, and it's tempting to assume ADVANCED is "GIN/GiST but faster via RUM." In practice AdvancedStrategy's query computes word_similarity() per candidate row and sorts in memory (ORDER BY ... DESC) — no index type, RUM included, can serve that ordering directly. What actually accelerates this tier is the <% trigram operator's index pre-filter, which needs a standard GiST/GIN gist_trgm_ops/gin_trgm_ops index, not RUM. RUM also isn't a standard Postgres contrib module and may not be installable on your instance. See CLI & Migrations.

Choosing a Tier

  • LITE: Best for admin panels, small internal tools, or early-stage MVPs. Requires zero database migrations.
  • STANDARD: The sweet spot for most web applications. Hedges a Turbo-Mode FTS query against a combined ILIKE/trigram query and returns whichever finds results first.
  • ADVANCED: For datasets where STANDARD's pre-filter still lets too many candidate rows through — trades a wider trigram-indexed pre-filter for an in-memory word_similarity() sort (see callout above; it is not an index-served sort).
  • VECTOR: Semantic ("meaning of the query") search via embeddings — this tier is exclusive, not layered on top of FTS/trigram; it doesn't run alongside another tier for the same call.

You can generate (not fully automate — see CLI & Migrations) the required indices for your tier using the interactive CLI.