liveBook · Manning

Slot-based query engine

As explained in MongoDB 8.0 in Action, Third Edition

The slot-based query engine is MongoDB's query execution engine that represents intermediate values in slots and generally reduces CPU and memory use.

The slot-based query engine is MongoDB’s execution engine for representing intermediate values in slots. It generally uses less CPU and memory and often performs better than the classic query engine. MongoDB selects the engine automatically; applications cannot choose it manually. section 7.1.1 section 7.8

Use query diagnostics to identify the selected engine and investigate its performance:

  • Run db.collection.explain() or cursor.explain() with queryPlanner, executionStats, or allPlansExecution verbosity. section 7.1.1
  • Look for explain.queryPlanner.winningPlan.slotBasedPlan in explain output; its presence identifies slot-based execution. section 7.1.1
  • Check logs for queryFramework: "sbe" or queryFramework: "classic" when explain output is unavailable. section 7.1.1
  • Expect common slot-based execution for aggregation pipelines containing $group or $lookup, while unsupported queries use the classic engine. section 7.1.1

Identifying slot-based execution

Run a query with explain("executionStats"), then inspect explain.queryPlanner.winningPlan. A winning plan containing slotBasedPlan indicates the slot-based engine; executionStats also reports returned documents, execution time, examined keys, and examined documents.

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Explains performance, supported pipeline stages, explain fields, and log identifiers without detailing slot internals.
Examples
Demonstrates explain() output containing slotBasedPlan and logs containing queryFramework values such as sbe or classic.
What you can do after
Diagnose query execution with explain() and logs, then relate engine choice to execution statistics and performance.
How it connects
Ties the slot-based query engine to the classic query engine, query planner, aggregation pipelines, indexes, explain plans, and database logs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.