Why Vector Search Slows Down: Storage Layer Optimization in Practice
This article examines why vector similarity search degrades in latency and throughput when it runs on a relational database, and how much of the gap can be closed by optimizing only the storage layer. It shows that a single query can trigger thousands of random page accesses, breaks down the overhead introduced by a general-purpose buffer pool under high-frequency random reads, and presents a simplified cost model comparing page access costs with distance computation costs. The article then outlines storage-layer changes that are orthogonal to the index algorithm—lighter address translation, finer-grained and lock-free concurrency control, asynchronous I/O with prefetching, vectorized replacement policies, and tiered placement—along with a practical tuning checklist and the metrics to measure before optimizing.
1. Background: Vector Search Enters the Engineering Mainstream
Large language model applications, reverse image search, recommendation recall, and similar-group detection in risk control have all pushed vector similarity search out of research papers and into the core path of production systems. When teams evaluate options, they usually face two choices: adopt a dedicated vector search system, or reuse the vector extension capabilities of an existing relational database.
The appeal of the second option is direct. There is no need to add another cluster, backup setup, monitoring stack, or permission system. Transactional data and vector data can be filtered and joined within a single query, and existing operational experience carries over completely. But the approach is also widely criticized: once data volume grows from tens of thousands to tens of millions of records, recall and latency begin to degrade noticeably, and throughput and horizontal scalability fall short of dedicated systems.
This article is not about which option to choose. It addresses a more fundamental and more easily overlooked question: when vector search runs on a relational database, where does the time actually go? And if only the storage layer is optimized, how much of the gap can be closed?
2. Locating the Bottleneck: The Index Algorithm Is Often Not the Problem
2.1 Thousands of Page Accesses Behind a Single Query
Mainstream graph-based indexes (the hierarchical navigable small world family) behave as a large number of random jumps at query time: descending layer by layer from the entry point, repeatedly fetching neighbors from the candidate set, computing distances, and maintaining a priority queue. Cluster-partition indexes (the inverted file family) behave as sequential scans of several buckets followed by reordering.
The two share one characteristic: logically only a few thousand distance computations, but physically potentially thousands of data page accesses. The layout of those pages on disk has almost no correlation with the order in which they are accessed, so the access pattern is highly random.
2.2 The Design Assumptions of a General-Purpose Buffer Pool No Longer Hold
A general-purpose database buffer pool is designed for transactional workloads: decent access locality, a controllable read/write ratio, and a limited number of pages touched by a single query. It therefore assumes every page access goes through the full path—locating the buffer descriptor in a global hash table, pinning and unpinning the page, acquiring and releasing latches, maintaining the linked lists of the replacement algorithm, and recording dirty pages for flushing at the appropriate time.
Under high-frequency random access, this path introduces three kinds of cost:
- Instruction and cache overhead: address translation and concurrency control logic consume large numbers of CPU cycles and pollute the CPU cache;
- Reduced parallelism: chained pointer chasing destroys the predictability of memory prefetching, and the out-of-order execution and prefetch mechanisms of modern hardware become largely ineffective;
- Degraded asynchronous I/O: random synchronous waits make it hard to keep the disk queue full, so bandwidth utilization stays low.
In engineering practice, this kind of low-level overhead often accounts for the majority of total query time (commonly observed at above seventy percent). In other words, no matter how much the index algorithm is improved, it remains capped by the fixed cost of the storage layer.
2.3 A Simplified Cost Model
Total query time can be roughly written as:
T_query ≈ N_page × (C_translate + C_lock + C_io_wait) + N_dist × C_distance
where N_page is the number of page accesses and N_dist is the number of distance computations. Index algorithm optimization mainly reduces N_dist, while storage layer optimization reduces the three terms inside the parentheses. Once N_page reaches the thousands, the payoff of the latter far outweighs the former.
3. A General Optimization Path: Storage Layer Changes Orthogonal to the Index Algorithm
The key observation is that page address translation, concurrency control, and I/O scheduling are independent of which index algorithm sits above them. As long as the index accesses pages through a unified buffer pool interface, the underlying implementation can be replaced without touching the algorithm logic. Practical measures include:
- Lightweight address translation: replace the global hash lookup with a compact mapping structure to reduce pointer chasing and improve cache hit rates;
- Fine-grained and lock-free concurrency control: narrow latch granularity and shorten critical sections, and use an optimistic read path for read-heavy, write-light workloads to cut pin/unpin overhead;
- Reworked scheduling and prefetching for random reads: hand batch prefetching and queue depth control to a dedicated scheduling layer so that I/O becomes truly asynchronous;
- Vectorized replacement policy: maintain replacement metadata in batches instead of updating linked lists page by page;
- Tiered placement: keep hot pages resident in memory, move warm and cold pages to object storage or block storage, and let the scheduling layer decide promotion and eviction.
A sketch of the interface abstraction (pseudocode, expressing only the layering idea):
// The upper-layer index depends only on a unified page access interface and does not care about the underlying implementationpage_t *buf_pin(buf_pool_t *pool, page_id_t id);void buf_unpin(buf_pool_t *pool, page_t *page);int buf_prefetch(buf_pool_t *pool, page_id_t *ids, int n);
Replacing the implementation of buf_pool_t delivers the gains with zero changes on the index side—which is exactly the value of orthogonal optimization.
4. Practical Recommendations and a Tuning Checklist
- Measure before optimizing: turn on metrics for page access counts, buffer hit rate, latch waits, and I/O queue depth to confirm the bottleneck really is in the storage layer;
- Compare at the same recall level: any performance conclusion must hold at the same recall (or the same error threshold), otherwise the numbers mean nothing;
- Validate per scenario: data fully resident in memory and data that exceeds memory and must spill to disk are two very different workloads and need to be load tested separately;
- Control vector dimensionality and quantization error: dimensionality reduction and quantization can significantly reduce
N_dist, but the recall loss must be evaluated; - Capacity and lifecycle: plan dedicated partitions, hot/cold tiering, and rebuild windows for vector data so that index construction does not affect online queries;
- Observability support: connect general monitoring, alerting, and logging services, and bring latency percentiles, recall, and resource utilization onto the same dashboard.
When deploying in the cloud, a container platform can host the stateless query layer, block storage and object storage can hold tiered data, and monitoring, alerting, and logging services can provide observability—without binding to any vendor’s proprietary interfaces.
5. Conclusion
The performance problems of vector search are often not a matter of “the algorithm is not new enough,” but of “the general-purpose storage layer is a poor fit for a random, high-frequency, read-only page access pattern.” Abstracting the buffer pool into a replaceable component and specializing address translation, concurrency, and asynchronous I/O is a path with small changes, clear benefits, and the ability to stack with algorithmic innovation. Teams are advised to start from metric measurement, evaluate the actual gains of storage layer changes at the same recall level, and only then decide whether a dedicated system is needed.
