Skip to content

(DOCS-14833): Add parameter to control SBE cache #5984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions source/includes/fact-sbe-plan-cache-motivation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Increasing the plan cache size adds more cached query shapes for the
:ref:`query planner <read-operations-query-optimization>`. This can
improve query performance, but increases memory usage.
124 changes: 83 additions & 41 deletions source/reference/parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -907,47 +907,6 @@ General Parameters

:parameter:`connPoolMaxShardedConnsPerHost`

.. parameter:: internalQueryEnableSlotBasedExecutionEngine

.. versionadded:: 5.1

*Type*: boolean

*Default*: true

|mongod-only|

If :parameter:`internalQueryEnableSlotBasedExecutionEngine` is
``true``:

- Enhanced query execution is used if possible. If used, the document
structure is separated from the document content, and only the
required fields are used in the engine computations. This improves
performance and ensures database resources are efficiently used.

- If enhanced query execution is used, the query plan :ref:`explain
results <explain-results-enhanced-execution>` have a different
structure and contain additional information about the execution
plan.

If :parameter:`internalQueryEnableSlotBasedExecutionEngine` is
``false``, enhanced query execution is not used.

The following sets
:parameter:`internalQueryEnableSlotBasedExecutionEngine` to
``false``:

.. code-block:: bash

mongod --setParameter internalQueryEnableSlotBasedExecutionEngine=false

You can also use the :dbcommand:`setParameter` command within the
:mongosh:`MongoDB Shell </>`:

.. code-block:: javascript

db.adminCommand( { setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false } )

.. parameter:: shardedConnPoolIdleTimeoutMinutes

.. versionadded:: 3.6.3
Expand Down Expand Up @@ -4230,3 +4189,86 @@ Transaction Parameters
.. code-block:: javascript

db.adminCommand( { setParameter: 1, shouldMultiDocTxnCreateCollectionAndIndexes: false } )

Slot-Based Execution Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. parameter:: internalQueryEnableSlotBasedExecutionEngine

.. versionadded:: 5.1

*Type*: boolean

*Default*: true

|mongod-only|

If :parameter:`internalQueryEnableSlotBasedExecutionEngine` is
``true``:

- Enhanced query execution is used if possible. If used, the document
structure is separated from the document content, and only the
required fields are used in the engine computations. This improves
performance and ensures database resources are efficiently used.

- If enhanced query execution is used, the query plan :ref:`explain
results <explain-results-enhanced-execution>` have a different
structure and contain additional information about the execution
plan.

If :parameter:`internalQueryEnableSlotBasedExecutionEngine` is
``false``, enhanced query execution is not used.

The following sets
:parameter:`internalQueryEnableSlotBasedExecutionEngine` to
``false``:

.. code-block:: bash

mongod --setParameter internalQueryEnableSlotBasedExecutionEngine=false

You can also use the :dbcommand:`setParameter` command within the
:mongosh:`MongoDB Shell </>`:

.. code-block:: javascript

db.adminCommand( { setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false } )

.. parameter:: planCacheSize

.. versionadded:: 5.1

*Type*: string

*Default*: 5%

|mongod-only|

Sets the size of the :ref:`plan cache
<read-operations-query-optimization>` for the enhanced query
execution engine.

You can set the :parameter:`planCacheSize` value to either:

- A percentage of the system's total physical memory to allocate for
the plan cache. For example, ``"8.5%"``.

- The exact amount of data to allocate for the plan cache in either
``MB`` or ``GB``. For example, ``"100MB"`` or ``"1GB"``.

.. include:: /includes/fact-sbe-plan-cache-motivation.rst

The following startup command sets :parameter:`planCacheSize` to 80
megabytes:

.. code-block:: bash

mongod --setParameter planCacheSize="80MB"

You can also use the :dbcommand:`setParameter` command within the
:mongosh:`MongoDB Shell </>`:

.. code-block:: javascript

db.adminCommand( { setParameter: 1, planCacheSize: "80MB" } )

42 changes: 26 additions & 16 deletions source/release-notes/5.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,32 @@ Starting in MongoDB 5.1, :expression:`$dateSubtract` and
:expression:`$dateAdd` report an error when an overflow is detected for
``amount`` values.

.. _5.1-rel-notes-sbe:

Slot-Based Query Execution Engine
---------------------------------

Starting in MongoDB 5.1, a new query execution engine is available,
which improves query performance.

If the new parameter
:parameter:`internalQueryEnableSlotBasedExecutionEngine` is ``true``:

- The new query execution engine is used if possible.

- If the new query execution engine is used, new fields are included in
the :ref:`query explain plan output
<explain-results-enhanced-execution>`.

Set Slot-Based Query Execution Plan Cache Size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can set the size of the :ref:`plan cache
<read-operations-query-optimization>` for the new query engine with the
:parameter:`planCacheSize` parameter.

.. include:: /includes/fact-sbe-plan-cache-motivation.rst

.. _5.1-rel-notes-change-streams:

Change Streams
Expand Down Expand Up @@ -95,22 +121,6 @@ Aggregation Metrics
Resharding Statistics
- :serverstatus:`shardingStatistics.resharding.lastOpEndingChunkImbalance`


New Slot-Based Query Execution Engine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Starting in MongoDB 5.1, a new query execution engine is available,
which improves query performance.

If the new parameter
:parameter:`internalQueryEnableSlotBasedExecutionEngine` is ``true``:

- The new query execution engine is used if possible.

- If the new query execution engine is used, new fields are included in
the :ref:`query explain plan output
<explain-results-enhanced-execution>`.

Geo Indexing for Time Series collections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down