You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/database-engine/configure-windows/optimize-for-ad-hoc-workloads-server-configuration-option.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: optimize for ad hoc workloads (server configuration option)
3
3
description: "Learn about the 'optimize for ad hoc workloads' option. Use it to improve SQL Server plan cache efficiency when workloads contain many single-use ad hoc batches."
4
4
author: rwestMSFT
5
5
ms.author: randolphwest
6
-
ms.date: 12/18/2023
6
+
ms.date: 12/28/2023
7
7
ms.service: sql
8
8
ms.subservice: configuration
9
9
ms.topic: conceptual
@@ -17,7 +17,7 @@ helpviewer_keywords:
17
17
18
18
The **optimize for ad hoc workloads** option is used to improve the efficiency of the plan cache for workloads that contain many single use ad hoc batches. When this option is set to `1`, the Database Engine stores a small compiled plan stub in the plan cache when a batch is compiled for the first time, instead of the full compiled plan. This option might help to relieve memory pressure by not allowing the plan cache to become filled with compiled plans that aren't reused. However, enabling this option might affect your ability to troubleshoot single-use plans.
19
19
20
-
The compiled plan stub allows the [!INCLUDE [ssDE](../../includes/ssde-md.md)] to recognize that this ad hoc batch was compiled before, only stores a compiled plan stub. When this batch is invoked (compiled or executed) again, the [!INCLUDE [ssDE](../../includes/ssde-md.md)] compiles the batch, removes the compiled plan stub from the plan cache, and adds the full compiled plan to the plan cache.
20
+
The compiled plan stub allows the [!INCLUDE [ssDE](../../includes/ssde-md.md)] to recognize that this ad hoc batch was compiled previously, and only stores a compiled plan stub. When this batch is invoked (compiled or executed) again, the [!INCLUDE [ssDE](../../includes/ssde-md.md)] compiles the batch, removes the compiled plan stub from the plan cache, and adds the full compiled plan to the plan cache.
21
21
22
22
You can find compiled plan stubs by querying the `sys.dm_exec_cached_plans` catalog view and looking for "Compiled Plan" in the `cacheobjtype` column. The stub has a unique `plan_handle`. The compiled plan stub doesn't have an execution plan associated with it, and querying for the plan handle doesn't return a graphical or XML showplan.
23
23
@@ -57,11 +57,11 @@ To find the number of single-use cached plans, run the following query:
0 commit comments