explaingit

intelligent-internet/psql_bm25s

Analysis updated 2026-05-18

127PLpgSQLAudience · developerComplexity · 4/5Setup · moderate

TLDR

A PostgreSQL extension that adds fast BM25 text search directly inside the database, built for constantly changing data.

Mindmap

mindmap
  root((repo))
    What it does
      BM25 text search in Postgres
      Handles frequent updates
      Exact ranked results
    Tech stack
      PostgreSQL
      PLpgSQL
      C
    Use cases
      In database search
      Hybrid text and vector search
      Live changing datasets
    Audience
      Developers
      Database engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add fast, ranked text search directly inside a PostgreSQL database without a separate search service.

USE CASE 2

Run BM25 style search on data that changes constantly, like a live application database.

USE CASE 3

Combine text search with vector similarity search for hybrid results in one query.

What is it built with?

PostgreSQLPLpgSQLC

How does it compare?

intelligent-internet/psql_bm25ssaiprajoth/timescaledb-labzombodb/zombodb
Stars12714,733
LanguagePLpgSQLPLpgSQLPLpgSQL
Setup difficultymoderatemoderatehard
Complexity4/53/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires installing a PostgreSQL extension and building an index with CREATE INDEX.

In plain English

psql_bm25s is a PostgreSQL extension, meaning a plugin that adds new capabilities to the PostgreSQL database, that brings BM25 style text search directly into the database itself. BM25 is a well established algorithm used by search engines to rank documents by how well they match a search query, the same basic approach behind many search systems people use every day. The core problem it solves is that existing BM25 search tools tend to work well on data that rarely changes, but struggle once records are constantly being added, updated, or deleted, which is the normal state of a live database. Rebuilding a search index from scratch every time data changes is expensive. psql_bm25s is built specifically to handle frequent changes efficiently, while still returning exact search results and respecting PostgreSQL's usual guarantees around crash recovery, backups, and replication. Once installed, a developer creates a BM25 search index using a standard CREATE INDEX command, then runs searches using ordinary SQL. It handles the usual text preparation steps: breaking text into individual words, normalizing them, removing common filler words, and reducing words to their root form. It can combine scores across multiple text columns in one search, and can also blend traditional text search with vector similarity search for hybrid results. The project publishes benchmark results comparing its query speed against a Python reference implementation and other PostgreSQL search extensions across fifteen standard datasets, reporting notably faster results, especially on large collections of documents. The full README is longer than what was provided.

Copy-paste prompts

Prompt 1
Show me how to create a BM25 search index on a text column using psql_bm25s.
Prompt 2
Write a SQL query that ranks documents by BM25 relevance using psql_bm25s.
Prompt 3
Explain how to combine text search and vector search in one query with psql_bm25s.
Prompt 4
Help me set up field weighted multicolumn search across two text columns.

Frequently asked questions

What is psql_bm25s?

A PostgreSQL extension that adds fast BM25 text search directly inside the database, built for constantly changing data.

What language is psql_bm25s written in?

Mainly PLpgSQL. The stack also includes PostgreSQL, PLpgSQL, C.

How hard is psql_bm25s to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is psql_bm25s for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.