---
title: "Postgres Vector and Keyword Search"
description: "Build hybrid search on PostgreSQL with pgvectorscale and pg_textsearch. Semantic and BM25 keyword search with ACID guarantees. Open-source and up in minutes."
url: "https://www.tigerdata.com/search"
---


# Two Extensions. Complete Search.

- **Zero Complexity:** Forget provisioning three separate systems. It's just one database.
- **Zero Latency:** Queries run where your data lives. No ETL pipelines or sync lag.
- **Total Consistency:** Single source of truth. Writes and searches are transactionally safe.

## Extensions

### pg_textsearch (BM25 / Keyword)

- Supports 29 languages
- Configurable parameters

### pgvectorscale (Vector / Semantic)

- 75% less cost on AWS
- Statistical Binary Quantization

## Hybrid Search

Combine BM25 keyword results and vector similarity results using Reciprocal Rank Fusion — all in a single SQL query.

```sql
-- BM25 keyword results
WITH keyword_results AS (
  SELECT id, ROW_NUMBER() OVER (ORDER BY content <@> 'search query') AS rank_kw
  FROM documents
  ORDER BY content <@> 'search query'
  LIMIT 20
),
-- Vector similarity results
semantic_results AS (
  SELECT id, ROW_NUMBER() OVER (ORDER BY embedding <=> $query_vec) AS rank_vec
  FROM documents
  ORDER BY embedding <=> $query_vec
  LIMIT 20
)
-- Reciprocal Rank Fusion
SELECT COALESCE(k.id, s.id) AS id,
  COALESCE(1.0/(60 + k.rank_kw), 0) + COALESCE(1.0/(60 + s.rank_vec), 0) AS rrf_score
FROM keyword_results k
FULL OUTER JOIN semantic_results s ON k.id = s.id
ORDER BY rrf_score DESC
LIMIT 10;
```

## Why Postgres for Search

### One system to operate

No ETL pipelines. No sync jobs. No eventual consistency. Insert a row and it's searchable.

### ACID guarantees for search

Your search index participates in transactions. Rollback a write and the index rolls back with it.

### Security you already have

Row-level security, roles, and permissions apply to search queries automatically.

### Backups include everything

pg_dump, streaming replication, point-in-time recovery—your search indexes are just part of your database.

### SQL you already know

No new query language. No client library. ORDER BY, LIMIT, WHERE, JOIN—search composes with everything else.
