pg_textsearch: Native BM25 Full-Text Search in Postgres
summary
An open-source Postgres extension implements production-grade BM25 ranking inside the database, using an LSM-tree-inspired architecture with an in-memory memtable that spills to immutable disk segments, shared-memory concurrency, and native crash recovery. It exposes a CREATE INDEX/ORDER BY/LIMIT SQL surface, supports partitioning and parallel bulk indexing, and reports benchmarked throughput improvements (average query latency ~81 ms vs 700 ms on MS MARCO passages at 138M docs). Background compaction and phrase queries are not yet implemented.
AI-written summary · about
chapters (14)
- 0:00Introduction and speaker background
- 0:43Search in Postgres overview
- 3:10Classical Boolean keyword search
- 5:18Limitations of classical search
- 7:03Introducing PG Text Search
- 9:30SQL interface and features
- 13:05Unsupported features
- 14:51Index architecture and write amplification
- 17:41LSM tree structure
- 19:26Index internals and components
- 19:48Performance benchmarks
- 21:55Lessons learned and challenges
- 22:56Development timeline and adoption
- 23:37Q&A session
