Advertisement
Intermediate SQL Server, SQL Server Architecture & Editions

What is tempdb, and why is its configuration particularly important for overall SQL Server performance?

Short answer

Tempdb is a special system database used by SQL Server for temporary objects like temporary tables, sorting operations, and row versioning, and since it is shared across the entire instance and heavily used by many different operations simultaneously, properly configuring it…

Save SQL Server mock interview
Advertisement
AModel answer
Tempdb is a special system database used by SQL Server for temporary objects like temporary tables, sorting operations, and row versioning, and since it is shared across the entire instance and heavily used by many different operations simultaneously, properly configuring it, such as using multiple equally sized data files, can significantly reduce contention and improve performance across your entire server.
-- Adding multiple tempdb files to reduce contention
ALTER DATABASE tempdb ADD FILE (
  NAME = tempdev2,
  FILENAME = 'C:\Data\tempdb2.mdf',
  SIZE = 512MB
);
Real-world example
A database administrator configures tempdb with multiple equally sized data files matching the number of available processor cores, resolving a contention issue that had been causing intermittent slowdowns across the entire server.
Likely follow-ups
  • How many tempdb files are generally recommended for a given server?
  • What kinds of operations put the heaviest load on tempdb?
Related topics