---
title: "Optimizing Document Lookup: Making Atlas Search and Vector Search Up to 5x Faster"
description: "MongoDB engineers identified that document materialization in Atlas Search and Vector Search spent roughly 30% of mongod CPU time on repeated query planning and collection resource acquisition rather than actual document retrieval. They redesigned the $_internalSearchIdLookup stage to reuse a parameterized SBE execution plan and batch lookups within a shared resource scope. This eliminated redundant plan construction and amortized resource acquisition across multiple documents. In benchmarks, end-to-end query latency dropped up to 4.9x for $search and 5.5x for $vectorSearch at 10,000 results, and throughput under 16 concurrent clients increased approximately 2.75x. The optimizations ship in MongoDB 9.0, are enabled by default, and require no application changes."
---

# Optimizing Document Lookup: Making Atlas Search and Vector Search Up to 5x Faster

[MongoDB](https://yomu.fyi/company/mongodb) · Nov 10, 2026

**Type:** Problem & solution

## Summary

MongoDB engineers identified that document materialization in Atlas Search and Vector Search spent roughly 30% of mongod CPU time on repeated query planning and collection resource acquisition rather than actual document retrieval. They redesigned the $\_internalSearchIdLookup stage to reuse a parameterized SBE execution plan and batch lookups within a shared resource scope. This eliminated redundant plan construction and amortized resource acquisition across multiple documents. In benchmarks, end-to-end query latency dropped up to 4.9x for $search and 5.5x for $vectorSearch at 10,000 results, and throughput under 16 concurrent clients increased approximately 2.75x. The optimizations ship in MongoDB 9.0, are enabled by default, and require no application changes.

## Context

MongoDB engineers profiled Atlas Search and Vector Search workloads and found that approximately 30% of mongod CPU time was spent on query plan construction and collection acquisition rather than document retrieval, because the original implementation built a new aggregation sub-pipeline for every document returned by mongot.

## Approach / What changed

Redesigned the $\_internalSearchIdLookup stage to reuse a parameterized SBE execution plan and batch document lookups within a shared resource scope, eliminating repeated query planning and collection resource acquisition.

## Takeaways

- Repeated query planning and collection resource acquisition for each document lookup consumed about 30% of mongod CPU time in Atlas Search and Vector Search workloads.
- The optimized path builds a parameterized SBE execution plan once and rebinds the \_id parameter for each lookup, eliminating redundant plan construction.
- Batching document lookups within a shared resource scope reduces collection resource acquisition from once per document to once per batch, amortizing overhead.

## FAQ

### Do I need to change my application code to get the speedup?

The optimizations ship in MongoDB 9.0 and are enabled by default. Applications do not need to rewrite queries, rebuild search indexes, or adopt new syntax; existing $search and $vectorSearch pipelines automatically benefit on supported configurations.

### How much faster are queries with large result sets?

The larger the result set, the greater the speedup. At 10,000 results, median latency dropped from about 2.6 seconds to 527 ms for Atlas Search (4.9x faster) and from 3.1 seconds to 561 ms for Atlas Vector Search (5.5x faster).

### Does the optimization improve throughput under concurrency?

The optimizations eliminate repeated query planning and resource acquisition, reducing unnecessary CPU work per document lookup. This allows mongod to process more concurrent search requests with the same execution resources, yielding approximately 2.75x higher throughput under 16 concurrent clients.

**Tags:** [Atlas Search](https://yomu.fyi/topic/atlas-search), [MongoDB](https://yomu.fyi/topic/mongodb), [Performance](https://yomu.fyi/topic/performance), [Vector Search](https://yomu.fyi/topic/vector-search)

- Source: [MongoDB](https://www.mongodb.com/company/blog/engineering/optimizing-document-lookup-making-atlas-search-vector-search-up-to-5x-faster)
- Source URL: https://www.mongodb.com/company/blog/engineering/optimizing-document-lookup-making-atlas-search-vector-search-up-to-5x-faster
- Ingested by Yomu: 2026-11-11T15:00:26.042Z

[Read original post](https://www.mongodb.com/company/blog/engineering/optimizing-document-lookup-making-atlas-search-vector-search-up-to-5x-faster)
