tempdb data files
Number of tempdb data files, which spreads allocation-page contention.
- Standard
Number of cores, up to 8- Range
- 1 to 32767 files
- Restart needed
- Nein
- Default checked on
- SQL Server 2025
Was es bewirkt
Not a single option but a file layout. Allocation contention (PAGELATCH waits on 2:1:1, 2:1:2, 2:1:3) is reduced by more equally sized files. Setup creates one per logical core up to 8.
Standardwert
Number of cores, up to 8. Setup default since SQL Server 2016; a 7-core Linux container gets 7 files.
Check the current value
SELECT name, physical_name, size * 8 / 1024 AS size_mb, growth * 8 / 1024 AS growth_mb FROM tempdb.sys.database_files WHERE type_desc = 'ROWS';
Change it
-- FILENAME is a Linux path; on Windows use the tempdb folder, e.g. D:\TempDB\tempdb9.ndf
ALTER DATABASE tempdb ADD FILE
(NAME = tempdev9, FILENAME = '/var/opt/mssql/data/tempdb9.ndf', SIZE = 8GB, FILEGROWTH = 512MB);
No restart to add files; removing or resizing them may require emptying them first. Keep all files the same size and growth.
When to change it
Add files in groups of 4 when PAGELATCH contention on tempdb allocation pages persists with 8 files.
What can go wrong
Unequal sizes defeat proportional fill and push allocations to the biggest file.
Questions about tempdb data files
What is the default value of tempdb data files in SQL Server?
Number of cores, up to 8. Setup default since SQL Server 2016; a 7-core Linux container gets 7 files.
Does changing tempdb data files require a restart?
No. No restart to add files; removing or resizing them may require emptying them first. Keep all files the same size and growth.
When should I change tempdb data files?
Add files in groups of 4 when PAGELATCH contention on tempdb allocation pages persists with 8 files.
Back to all SQL Server settings, or check the SQL Server manual for every option.
Check tempdb data files 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.