pg-smart-search
Getting Started

Introduction

Why pg-smart-search exists and when to use it. Compare search tiers and understand the core philosophy.

Introduction

pg-smart-search is a Node.js search engine SDK that lives entirely inside your PostgreSQL database. It is designed for developers who want search quality comparable to specialized engines but refuse to maintain separate infrastructure.

Who is this for?

  • Startups & SMBs who cant justify a $500/mo ElasticSearch cluster.
  • Enterprise Backend Engineers who need strict data sovereignty (GDPR, HIPAA).
  • Node.js/TypeScript developers looking for a native, type-safe search integration.

Search Tiers Comparison

Depending on your dataset size, the engine adapts its strategy automatically:

TierDataset SizeEngine FeaturesIndices Required
LITE< 100k rowsBasic ILIKENone
STANDARD100k - 1M rowsTrigrams + FTSGIN
ADVANCED> 1M rowsNormalized + RUMRUM + Trigrams
VECTORSemanticOpenAI/Geminipgvector (HNSW)

Benchmarks

Real-world performance measured on standard hardware:

  • Cold Latency (1M rows): ~39.33ms
  • Hot Latency (1M rows): ~6.27ms (Cached)
  • Algorithmic Scaling: O(log N)