Google Cloud now offers a preview of a native BM25 index in both AlloyDB and Cloud SQL for PostgreSQL 17+, powered by the open‑source pg_textsearch extension. The change folds traditional keyword ranking directly into the database, eliminating the need for a separate full‑text search service.
What Changed
Previously, achieving BM25‑style ranking required provisioning an external search engine and synchronizing it with the relational data store. The preview introduces a built‑in pg_textsearch extension that provides C‑optimized BM25 scoring on PostgreSQL tables. In AlloyDB, the same extension also enables ScaNN and HNSW vector indexes, delivering up to six‑fold and ten‑fold faster vector queries compared with vanilla PostgreSQL.
Why It Matters for AI, Platform, and Ops Teams
Hybrid search patterns—combining semantic vector similarity with exact keyword relevance—are common in retrieval‑augmented generation (RAG) and data‑agent pipelines. By moving BM25 into the primary database, engineers avoid data duplication, ETL pipelines, and the operational overhead of a second service. The result is a single source of truth for both structured data and search indexes, which simplifies deployment, scaling, and monitoring.
Implementation Considerations
Adopting the native BM25 index follows a familiar PostgreSQL extension workflow:
CREATE EXTENSION IF NOT EXISTS pg_textsearch; CREATE INDEX bm25_idx ON cymbal_products USING bm25 (product_name, product_description);
After the extension is enabled, queries can invoke the BM25 ranking function provided by pg_textsearch. For vector‑enhanced queries on AlloyDB, the same table can host a product_embedding column and be indexed with ScaNN or HNSW types, using the same extension‑based syntax.
Operational and Security Implications
- Reduced surface area: Consolidating search into the database removes a separate service endpoint, decreasing the number of network hops and potential misconfigurations.
- Consistency guarantees: Since the index lives alongside the source rows, transactional consistency is inherited from the underlying PostgreSQL engine.
- Resource planning: BM25 indexing and vector indexing consume CPU and storage within the database instance. Capacity planning should account for the additional workload, especially for large corpora.
- Backup and recovery: Index data is now part of the regular database backup set, simplifying disaster‑recovery procedures but also increasing backup size.
- Access control: Search permissions continue to be governed by the database’s role‑based privileges; no new external access controls are introduced.
Related CloudNinjas coverage: Google Cloud.
What This Means For Practitioners
Teams building RAG pipelines or product‑catalog search can replace external full‑text services with a single PostgreSQL instance that supports both BM25 ranking and, on AlloyDB, accelerated vector search. Evaluate the preview in a staging environment, measure index build time and query latency against your workload, and adjust instance sizing accordingly. Monitor CPU and I/O metrics after enabling the extension to ensure the added indexing work does not impact existing transaction performance. Finally, incorporate the new index into your backup and security policies, treating it as part of the primary data set rather than an auxiliary component.


