Optimize For Ad Hoc Workloads
The optimize for ad hoc workloads setting can be used to improve the efficiency of the execution plan cache, particularly for systems when there are a large number of ad hoc or single-use queries.
💡 Select 'Suggested Script' for an automatically generated script.
Enable Optimize for Ad Hoc Workloads.
How to Enable 'Optimize for Ad Hoc Workloads; On SQL Server
EXEC sys.sp_configure N'optimize for ad hoc workloads', N'1' RECONFIGURE; GO
Optimize for ad hoc workloads | Microsoft Docs