<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/native-bm25-search-in-alloydb-and-cloud-sql-ktxbru6mj" -->

---
title: Native BM25 search in AlloyDB and Cloud SQL | daily.dev
description: AlloyDB and Cloud SQL for PostgreSQL 17+ now offer a native BM25 index in preview, built on the open-source pg_textsearch extension from TigerData. This...
canonical: https://daily.dev/posts/native-bm25-search-in-alloydb-and-cloud-sql-ktxbru6mj
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Native BM25 search in AlloyDB and Cloud SQL | daily.dev
og:description: AlloyDB and Cloud SQL for PostgreSQL 17+ now offer a native BM25 index in preview, built on the open-source pg_textsearch extension from TigerData. This...
og:url: https://daily.dev/posts/native-bm25-search-in-alloydb-and-cloud-sql-ktxbru6mj
og:image: https://api.daily.dev/og/posts/kTXBrU6mj.png
og:image:alt: Native BM25 search in AlloyDB and Cloud SQL
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Native BM25 search in AlloyDB and Cloud SQL

**[Google Cloud](https://daily.dev/sources/gcp)** · 6 min read · 0 upvotes · 0 comments

## Summary

AlloyDB and Cloud SQL for PostgreSQL 17+ now offer a native BM25 index in preview, built on the open-source pg_textsearch extension from TigerData. This eliminates the need for a separate full-text search backend, removing data silos and sync lag between vector and keyword search systems. The post walks through creating a BM25 index with the new <@> operator, and shows hybrid search examples combining BM25 keyword ranking with vector search (ScaNN or HNSW) using Reciprocal Rank Fusion, either via AlloyDB's built-in hybrid_search UDF or CTEs in Cloud SQL. AlloyDB also gets up to 6x-10x faster vector search with ScaNN and HNSW compared to standard PostgreSQL.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://cloud.google.com/blog/products/databases/native-bm25-search-in-alloydb-and-cloud-sql>

## Questions this post answers

### How do I enable BM25 full-text search ranking in AlloyDB or Cloud SQL for PostgreSQL?

Install the pg_textsearch extension with CREATE EXTENSION pg_textsearch, then create an index using USING bm25 on the target text column with a text_config option, for example WITH (text_config='english'). Query relevance using the <@> operator, where a more negative score indicates a stronger match. This works on AlloyDB and Cloud SQL for PostgreSQL 17 and later, currently in preview.

_Developers wiring BM25 ranking into a Postgres stack can follow implementation news like this on daily.dev._

### How do I combine vector search and keyword search in AlloyDB without maintaining a separate full-text search system?

AlloyDB provides a built-in hybrid_search user-defined function that merges vector search (via ScaNN or HNSW indexes) and BM25 keyword search results using Reciprocal Rank Fusion, so both indexes live on the same table and query. Each search input is passed as JSONB specifying data_type, weight, key column, and either a query vector or query text, avoiding ETL pipelines and sync lag between separate systems.

_Teams deciding how to architect hybrid search can track approaches like this on daily.dev._

### Why does PostgreSQL's built-in ts_rank perform poorly for full-text search ranking at scale compared to BM25?

ts_rank lacks inverse document frequency support, so common words are weighted the same as rare ones, and it has no term-frequency saturation, meaning a document repeating a word 50 times can outrank one mentioning it just once. BM25 fixes both issues plus adds document length normalization, making it the information retrieval standard for ranking quality as a corpus grows.

_Developers weighing search ranking algorithms can compare trade-offs like these on daily.dev._

## Similar posts on daily.dev

- [Build a Hybrid Search Engine in PostgreSQL: BM25 \+ Vector Retrieval](https://daily.dev/posts/build-a-hybrid-search-engine-in-postgresql-bm25-vector-retrieval-sdowphrge) · freeCodeCamp · 2 upvotes · 0 comments
- [Better Relevance for AI Apps With BM25 Algorithm in PostgreSQL](https://daily.dev/posts/better-relevance-for-ai-apps-with-bm25-algorithm-in-postgresql-wrgphmk6m) · The New Stack · 1 upvotes · 0 comments
- [GitHub - timescale/pg\_textsearch: PostgreSQL extension for BM25 relevance-ranked full-text search. Postgres OSS licensed.](https://daily.dev/posts/github---timescale-pg-textsearch-postgresql-extension-for-bm25-relevance-ranked-full-text-search-p-xeiapecnq) · Hacker News · 11 upvotes · 0 comments
- [Watch Out Elasticsearch\! Tiger Data's PostgreSQL BM25 Search Extension Goes Open Source](https://daily.dev/posts/watch-out-elasticsearch-tiger-data-s-postgresql-bm25-search-extension-goes-open-source-i9m2ohtmp) · It's Foss · 32 upvotes · 0 comments

---

Tags: [#postgresql](https://daily.dev/tags/postgresql), [#gcp](https://daily.dev/tags/gcp), [#vector-search](https://daily.dev/tags/vector-search), [#full-text-search](https://daily.dev/tags/full-text-search), [#alloydb](https://daily.dev/tags/alloydb)

[View this post on daily.dev](https://daily.dev/posts/native-bm25-search-in-alloydb-and-cloud-sql-ktxbru6mj)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Native BM25 search in AlloyDB and Cloud SQL","url":"https://daily.dev/posts/native-bm25-search-in-alloydb-and-cloud-sql-ktxbru6mj","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/native-bm25-search-in-alloydb-and-cloud-sql-ktxbru6mj"},"datePublished":"2026-09-18T16:41:25.476Z","dateModified":"2026-09-18T16:41:48.964Z","description":"AlloyDB and Cloud SQL for PostgreSQL 17+ now offer a native BM25 index in preview, built on the open-source pg_textsearch extension from TigerData. This...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c8389e0d01460d44bba75ab1169983ab?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c8389e0d01460d44bba75ab1169983ab?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Google Cloud","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Google Cloud","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/gcp","url":"https://daily.dev/sources/gcp"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/native-bm25-search-in-alloydb-and-cloud-sql-ktxbru6mj","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"postgresql,gcp,vector-search,full-text-search,alloydb","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Google Cloud","item":"https://daily.dev/sources/gcp"},{"@type":"ListItem","position":3,"name":"Native BM25 search in AlloyDB and Cloud SQL"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/native-bm25-search-in-alloydb-and-cloud-sql-ktxbru6mj#faq","mainEntity":[{"@type":"Question","name":"How do I enable BM25 full-text search ranking in AlloyDB or Cloud SQL for PostgreSQL?","acceptedAnswer":{"@type":"Answer","text":"Install the pg_textsearch extension with CREATE EXTENSION pg_textsearch, then create an index using USING bm25 on the target text column with a text_config option, for example WITH (text_config='english'). Query relevance using the \u003c@\u003e operator, where a more negative score indicates a stronger match. This works on AlloyDB and Cloud SQL for PostgreSQL 17 and later, currently in preview. Developers wiring BM25 ranking into a Postgres stack can follow implementation news like this on daily.dev."}},{"@type":"Question","name":"How do I combine vector search and keyword search in AlloyDB without maintaining a separate full-text search system?","acceptedAnswer":{"@type":"Answer","text":"AlloyDB provides a built-in hybrid_search user-defined function that merges vector search (via ScaNN or HNSW indexes) and BM25 keyword search results using Reciprocal Rank Fusion, so both indexes live on the same table and query. Each search input is passed as JSONB specifying data_type, weight, key column, and either a query vector or query text, avoiding ETL pipelines and sync lag between separate systems. Teams deciding how to architect hybrid search can track approaches like this on daily.dev."}},{"@type":"Question","name":"Why does PostgreSQL's built-in ts_rank perform poorly for full-text search ranking at scale compared to BM25?","acceptedAnswer":{"@type":"Answer","text":"ts_rank lacks inverse document frequency support, so common words are weighted the same as rare ones, and it has no term-frequency saturation, meaning a document repeating a word 50 times can outrank one mentioning it just once. BM25 fixes both issues plus adds document length normalization, making it the information retrieval standard for ranking quality as a corpus grows. Developers weighing search ranking algorithms can compare trade-offs like these on daily.dev."}}]}
```

