// sql server · temporary storage

tempdb metadata memory-optimized

Keep tempdb system tables in memory-optimized tables to remove metadata contention.

預設
0
Range
0 or 1
Restart needed
是
Default checked on
SQL Server 2025

其作用

Available from SQL Server 2019. Targets PAGELATCH contention on tempdb system tables from heavy temporary table creation and drop.

預設值

0. 0 (SQL Server 2025).

Check the current value

SELECT name, value, value_in_use, minimum, maximum, is_dynamic, is_advanced
FROM sys.configurations
WHERE name = 'tempdb metadata memory-optimized';

-- EXEC sp_configure 'tempdb metadata memory-optimized'; also works, but only while show advanced options is 1;
-- otherwise it fails with Msg 15123 because this is an advanced option.

Change it

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'tempdb metadata memory-optimized', 1;
RECONFIGURE;
-- then restart the SQL Server service

Restart required: value_in_use changes only after the SQL Server service restarts (is_dynamic = 0). It is an advanced option, so show advanced options must be on to change it.

When to change it

Workloads that create and drop many temporary tables per second and show PAGELATCH waits on tempdb system pages not explained by allocation pages.

What can go wrong

Needs a restart, and it has documented limitations: for example, one transaction cannot touch memory-optimized tables in a user database and tempdb system views at the same time. Read the list before enabling it.

Questions about tempdb metadata memory-optimized

What is the default value of tempdb metadata memory-optimized in SQL Server?

0. 0 (SQL Server 2025).

Does changing tempdb metadata memory-optimized require a restart?

Yes. Restart required: value_in_use changes only after the SQL Server service restarts (is_dynamic = 0). It is an advanced option, so show advanced options must be on to change it.

When should I change tempdb metadata memory-optimized?

Workloads that create and drop many temporary tables per second and show PAGELATCH waits on tempdb system pages not explained by allocation pages.

Back to all SQL Server settings, or check the SQL Server manual for every option.

// one client for every engine

Check tempdb metadata memory-optimized on your own server

SQLly runs the query above against SQL Server and the other engines in this reference, from one desktop app on macOS, Windows and Linux.