Google boosts AlloyDB vector search with HNSW preview

Google Enhances AlloyDB with Columnar Engine-Accelerated HNSW

Google has unveiled a preview of its columnar engine-accelerated HNSW feature for AlloyDB, promising an impressive increase in vector search throughput by as much as four times. This enhancement specifically targets users of pgvector, the PostgreSQL extension widely utilized for storing, indexing, and querying vector embeddings in artificial intelligence applications. The focus is on teams conducting approximate nearest neighbor searches using HNSW, or Hierarchical Navigable Small World, across extensive datasets.

AlloyDB, Google’s managed PostgreSQL-compatible database service, leverages this new capability by utilizing its columnar engine. This in-memory cache is designed to store frequently queried data in a column-based format, allowing HNSW indexes to reside in memory and circumvent some of the traditional overhead associated with PostgreSQL’s buffer management.

According to Google, this advancement enhances both throughput and recall—the metric that indicates how many relevant matches a search yields. In benchmark tests conducted on the GloVe 100 Angular dataset, which comprises over 1 million records and has a search limit of 100, queries per second surged by approximately 4.2x to 4.9x while maintaining a target recall of 0.95.

At a throughput of around 350 queries per second, recall improved significantly, rising from approximately 0.78 to over 0.94, marking a gain of 0.163 when the columnar engine setting was activated.

How it works

In standard PostgreSQL, index operations depend on a shared buffer cache, even when the data is already in memory. This process involves page pinning and unpinning, lock handling, buffer table lookups, and least recently used management, all of which can introduce latency and diminish efficiency during graph traversal.

AlloyDB alters this approach by pinning the pgvector HNSW index directly into the memory space of the columnar engine. It employs a memory layout tailored for the pointer-heavy traversal patterns that HNSW necessitates, effectively bypassing the typical bottlenecks associated with buffer management.

Google emphasized that the performance improvements are not merely the result of transferring data from disk to RAM. The baseline comparison already assumed that the standard PostgreSQL index was fully cached in shared buffers, indicating that the reported enhancements stem from a distinct memory architecture rather than basic caching techniques.

This launch comes in response to the increasing demand for database solutions that can support retrieval-augmented generation and other AI workloads reliant on vector search capabilities. In these systems, operators often face the challenge of balancing speed and accuracy while searching through millions or billions of vectors, particularly under production traffic conditions.

For PostgreSQL users, pgvector has emerged as one of the most popular tools in this domain, enabling vector functions to operate within an established relational database framework. HNSW is favored as an indexing method within pgvector due to its ability to provide approximate search results with lower latency compared to exact k-nearest neighbor methods, albeit with an accepted trade-off in recall.

Operational trade-offs

The columnar engine’s reliance on memory presents a practical consideration for database operators who must manage costs and instance sizing effectively. Google asserts that the memory footprint remains manageable, as the engine stores vector data in a compressed columnar format.

Google contends that this trade-off could lead to reduced infrastructure requirements, enabling users to achieve desired levels of vector search performance with less computational power. Furthermore, the feature does not necessitate any alterations to application code, allowing users to continue utilizing standard pgvector SQL syntax.

To activate this feature, AlloyDB users must enable both the columnar engine and index caching flags on their instance. After establishing an HNSW index through pgvector, users can then add that index to the columnar engine cache using a SQL command.

This rollout provides Google with another avenue to distinguish AlloyDB in the competitive landscape of databases tailored for AI workloads, where cloud providers and specialized database entities are vying for supremacy in throughput, latency, and search quality, rather than merely focusing on storage capabilities. The benchmarks cited by Google were executed on an AlloyDB C4A machine equipped with 16 virtual CPUs.

Tech Optimizer
Google boosts AlloyDB vector search with HNSW preview