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:
| Tier | Dataset Size | Engine Features | Indices Required |
|---|---|---|---|
| LITE | < 100k rows | Basic ILIKE | None |
| STANDARD | 100k - 1M rows | Trigrams + FTS | GIN |
| ADVANCED | > 1M rows | Normalized + RUM | RUM + Trigrams |
| VECTOR | Semantic | OpenAI/Gemini | pgvector (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)