Native BM25 Support Lands in AlloyDB and Cloud SQL to Revolutionize PostgreSQL Hybrid Search

The landscape of modern artificial intelligence and database architecture has shifted significantly with the introduction of native BM25 indexing in Google Cloud’s AlloyDB and Cloud SQL for PostgreSQL 17+. This development addresses a long-standing engineering challenge: bridging the gap between the conceptual understanding of semantic vector search and the absolute precision of traditional keyword-based full-text search. By integrating the open-source pg_textsearch extension directly into managed database environments, developers can now deploy sophisticated hybrid search applications without maintaining separate, complex search infrastructure.
The Evolution of Search in the Age of Generative AI
To understand the weight of this technological update, one must examine the limitations of modern search architectures. Over the past several years, generative AI, retrieval-augmented generation (RAG), and autonomous data agents have driven massive adoption of vector embeddings. Vector search excels at capturing semantic meaning, nuance, and intent. If a user asks an AI model for "trees that grow taller than houses," a vector search engine can easily translate that conceptual query into mathematical coordinates and return relevant botanical matches.
However, vector embeddings are notoriously weak when handling exact alphanumeric strings, specific product SKU numbers, serial numbers, proper nouns, or unique identifiers. In these scenarios, a vector search might return conceptually related items while completely missing the exact record a user or enterprise application requires. Conversely, traditional full-text search engines excel at exact keyword matching but lack any contextual awareness of semantic meaning.
Historically, bridging this gap required a hybrid search approach that combined vector embeddings with full-text search engines. For PostgreSQL users, this meant deploying and synchronizing secondary systems alongside their primary databases. These disparate architectures inevitably created data silos, synchronization lags, infrastructure overhead, and operational complexities that slowed development cycles and increased total cost of ownership.

Overcoming PostgreSQL’s Native Full-Text Limitations
For database administrators and developers working at scale, standard PostgreSQL features like ts_rank have long presented a performance ceiling. As data corpuses grow, ranking quality within native PostgreSQL implementations degrades. Furthermore, older native functions lack native support for inverse document frequency (IDF)—meaning common words carry the same statistical weight as rare, highly specific terms—and they lack term-frequency saturation, which prevents heavily repeated words from disproportionately dominating a search result.
Recognizing these engineering hurdles, Tiger Data developed the open-source pg_textsearch extension. By bringing the Best Matching 25 (BM25) algorithm directly to PostgreSQL pages, the extension implements the gold standard of information retrieval. BM25 introduces three critical pillars of modern search: inverse document frequency, ensuring rarer terms carry more weight; term frequency saturation, preventing keyword stuffing from breaking search relevance; and document length normalization, which balances the scoring between brief notes and extensive textual descriptions.
The Integration into AlloyDB and Cloud SQL
Google Cloud’s decision to natively incorporate pg_textsearch into AlloyDB and Cloud SQL for PostgreSQL 17+ eliminates the friction of maintaining external search backends. Because the search functionality resides directly inside the operational database, enterprises can execute hybrid queries without provisioning separate search clusters or managing complex data replication pipelines.
In practice, implementing a hybrid search system in these environments relies on combining vector indexes—such as ScaNN in AlloyDB or HNSW in Cloud SQL—with the new BM25 index. When a query is executed, the database processes both the semantic vector search and the exact keyword BM25 search, subsequently merging and reranking the results into a unified list using the Reciprocal Rank Fusion (RRF) algorithm.

Technical Implementation and Practical Application
To illustrate the practical deployment of native BM25 search, consider a hypothetical retail inventory dataset named cymbal_products. This table contains unique identifiers (uniq_id), product names, detailed textual descriptions (product_description), and generated vector embeddings (product_embedding).
Administrators begin by enabling the pg_textsearch extension and establishing a BM25 index directly on the product description column. Utilizing the specialized <@> operator, users can execute precise full-text queries—such as searching for "cherry tree"—where more negative numerical scores indicate stronger relevance matches.
For comprehensive hybrid search capabilities, AlloyDB provides a built-in user-defined function (UDF) that automates the merging of vector and keyword results via RRF. For instance, a query can simultaneously execute a vector search for conceptual criteria ("trees that grow taller than houses") and a keyword filter for geographic specificity ("California"). The database evaluates both parameters and surfaces highly specific, locally relevant items—such as the "California Sycamore"—at the absolute top of the search results page.
Cloud SQL for PostgreSQL users achieve identical outcomes by combining vector and keyword indexes on the same table, leveraging Common Table Expressions (CTEs), and coalescing the RRF scores within standard SQL syntax. The resulting output bridges semantic intuition with exact keyword matching, delivering enterprise-grade search performance.
Industry Implications and Future Outlook

The availability of native BM25 search within managed PostgreSQL services marks a maturing phase for enterprise data architecture. As organizations increasingly deploy production-grade generative AI applications, the demand for low-latency, highly accurate data retrieval systems has never been higher.
Industry analysts note that reducing architectural complexity directly translates to lower operational costs and faster time-to-market for AI-driven features. By removing the necessity to synchronize operational databases with external search indexes, Google Cloud has streamlined the developer experience for building RAG applications, intelligent customer service bots, and advanced data agents.
As the open-source community continues to refine extensions like pg_textsearch and cloud providers integrate these capabilities into core database offerings, the traditional boundaries between relational storage, vector search, and full-text retrieval continue to dissolve. For PostgreSQL users managing mission-critical workloads, the era of unified, native hybrid search has officially arrived.







