Configure TempDB for MSSQL Performance on a Windows VPS
Eliminate TempDB allocation contention with multiple equal-sized data files. Min(8, vCPU) files, fixed autogrowth, optional separate disk.

On this page
- In short
- Quick verdict
- Why TempDB matters
- What we tested on Raff
- Step 1 - Check current TempDB layout
- Step 2 - Check CPU count for file planning
- Recommended TempDB file count
- Step 3 - Choose file size and autogrowth
- Step 4 - Apply TempDB configuration
- Step 5 - Restart SQL Server
- Step 6 - Verify TempDB layout after restart
- Production sizing guidance
- Where should TempDB live?
- Autogrowth best practices
- Should all TempDB data files be equal?
- TempDB log file guidance
- Common mistakes
- What Raff recommends
- Tested on
- What's next
- Sources
Don't have a Windows Server yet?
Deploy Windows Server 2019/2022/2025 in ~2 minutes. 6-month evaluation licence included.
In short
TempDB is one of the busiest system databases in SQL Server. It is used for temporary tables, sorting, joins, row versioning, spills, index operations, and many internal SQL Server tasks. On a Windows VPS, poor TempDB configuration can create avoidable performance problems. A practical starting point is to use multiple TempDB data files, fixed file sizes, fixed autogrowth, and a layout that matches the VPS CPU count and workload.
Quick verdict
| Situation | Recommended action |
|---|---|
| Fresh SQL Server install | Check current TempDB file layout |
| 2-8 vCPU Windows VPS | Start with one TempDB data file per vCPU, up to 8 files |
| Files use percent autogrowth | Change to fixed MB autogrowth |
| TempDB files are tiny | Pre-size them to avoid constant growth |
| SQL Server workload uses sorting/reporting heavily | Monitor TempDB usage and spills |
| Production server | Change TempDB during a maintenance window |
| SQL Server Express test VM | Use small lab-safe TempDB sizes |
Do not blindly create dozens of TempDB files. Start with a sensible baseline, monitor, then adjust.
Why TempDB matters
TempDB is recreated every time SQL Server starts. Even though it is temporary, it is critical for performance.
SQL Server uses TempDB for:
- Temporary tables
- Table variables
- Sorting
- Hash joins
- Index rebuilds
- Row versioning
- Snapshot isolation
- Online operations
- Query spills
- Internal worktables
- Some DBCC operations
If TempDB is poorly configured, users may experience slow queries, blocking, high disk activity, or inconsistent performance during reporting and maintenance jobs.
For small databases, the default TempDB layout may be acceptable. For production SQL Server workloads, you should at least review it.
What we tested on Raff
We tested this walkthrough on a Raff Windows VPS running Windows Server 2025 Datacenter Evaluation and SQL Server 2025 Express.

Test environment:
| Item | Value |
|---|---|
| Provider | Raff Technologies |
| OS | Windows Server 2025 Datacenter Evaluation |
| SQL Server | SQL Server 2025 Express |
| Instance | SQLEXPRESS |
| CPU | 4 vCPU |
| Test database | TempDB system database |
| Test date | 2026-05-26 |
| Tester | Serdar Tekin |
On this VM, we verified:
- SQL Server service state
- Current TempDB file layout
- SQL Server CPU and scheduler count
- TempDB file count planning
- TempDB file size and growth configuration
- SQL Server service restart
- Final TempDB layout after restart
We used small lab-safe file sizes for the test. Production file sizes should be based on workload, disk capacity, and observed TempDB usage.
Step 1 - Check current TempDB layout
Before changing anything, check the current TempDB files.
Run:
powershellsqlcmd -S .\SQLEXPRESS -E -C -Q "SELECT name, type_desc, physical_name, size * 8 / 1024 AS size_mb, growth * 8 / 1024 AS growth_mb, is_percent_growth FROM tempdb.sys.database_files;"
Review:
| Column | Meaning |
|---|---|
name | Logical file name |
type_desc | ROWS for data file, LOG for log file |
physical_name | File path on disk |
size_mb | Current file size |
growth_mb | Autogrowth size |
is_percent_growth | Whether growth uses percent instead of fixed size |
For production, avoid percent-based growth. Fixed MB growth is more predictable.
Step 2 - Check CPU count for file planning
A common starting rule is:
Use one TempDB data file per logical CPU, up to 8 files, then monitor contention before adding more.
Check SQL Server CPU count:
powershellsqlcmd -S .\SQLEXPRESS -E -C -Q "SELECT cpu_count, scheduler_count FROM sys.dm_os_sys_info;"

For our 4 vCPU test VM, a reasonable baseline is:
text4 TempDB data files + 1 TempDB log file
For many SMB Windows VPS workloads, this is enough.
Recommended TempDB file count
Use this as a starting point:
| vCPU count | Starting TempDB data files |
|---|---|
| 1 vCPU | 1 file |
| 2 vCPU | 2 files |
| 4 vCPU | 4 files |
| 8 vCPU | 8 files |
| 16+ vCPU | Start with 8 files, then monitor |
Do not automatically create one file per CPU above 8. More files are not always better.
If you still see allocation contention after 8 files, investigate wait stats and workload behavior before adding more.
Step 3 - Choose file size and autogrowth
TempDB should not grow constantly during normal workload.
A good production strategy is:
- Estimate typical TempDB usage.
- Pre-size files so normal workload does not trigger growth.
- Use fixed MB autogrowth.
- Keep all TempDB data files the same size.
- Keep all TempDB data files with the same growth setting.
For the lab, we used small values:
| File type | Lab size | Lab growth |
|---|---|---|
| TempDB data files | 64 MB each | 64 MB |
| TempDB log file | 64 MB | 64 MB |
For production, common starting values may be larger:
| Workload | Starting data file size |
|---|---|
| Small app / dev | 256 MB - 1 GB each |
| SMB production app | 1-4 GB each |
| Reporting-heavy workload | Based on observed usage |
| Large SQL workload | Size from monitoring and testing |
Do not copy lab sizes into production without checking workload needs.
Step 4 - Apply TempDB configuration
In our lab, we configured four TempDB data files and fixed 64 MB autogrowth.
Run this only during a maintenance window on production servers.
powershellsqlcmd -S .\SQLEXPRESS -E -C -Q "USE master; ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, SIZE = 64MB, FILEGROWTH = 64MB); ALTER DATABASE tempdb ADD FILE (NAME = tempdev2, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL17.SQLEXPRESS\MSSQL\DATA\tempdev2.ndf', SIZE = 64MB, FILEGROWTH = 64MB); ALTER DATABASE tempdb ADD FILE (NAME = tempdev3, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL17.SQLEXPRESS\MSSQL\DATA\tempdev3.ndf', SIZE = 64MB, FILEGROWTH = 64MB); ALTER DATABASE tempdb ADD FILE (NAME = tempdev4, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL17.SQLEXPRESS\MSSQL\DATA\tempdev4.ndf', SIZE = 64MB, FILEGROWTH = 64MB); ALTER DATABASE tempdb MODIFY FILE (NAME = templog, SIZE = 64MB, FILEGROWTH = 64MB);"

Important notes:
- Adjust the file path for your SQL Server instance.
- Keep data files equal in size.
- Use fixed MB growth, not percent growth.
- Some changes require SQL Server restart.
- Do not make this change during business hours on production.
Step 5 - Restart SQL Server
TempDB is recreated when SQL Server starts, so some TempDB file changes appear after service restart.
Restart SQL Server Express:
powershellRestart-Service -Name 'MSSQL$SQLEXPRESS' -Force
Then verify the service is running:
powershellGet-Service -Name 'MSSQL$SQLEXPRESS'

For production, restart SQL Server only during a planned maintenance window.
Before restarting production SQL Server:
- Notify users.
- Confirm backups.
- Confirm no critical jobs are running.
- Schedule a maintenance window.
- Test application access after restart.
Step 6 - Verify TempDB layout after restart
Run the TempDB layout query again:
powershellsqlcmd -S .\SQLEXPRESS -E -C -Q "SELECT name, type_desc, physical_name, size * 8 / 1024 AS size_mb, growth * 8 / 1024 AS growth_mb, is_percent_growth FROM tempdb.sys.database_files;"
Expected result for our lab:
texttempdev ROWS 64 MB 64 MB
tempdev2 ROWS 64 MB 64 MB
tempdev3 ROWS 64 MB 64 MB
tempdev4 ROWS 64 MB 64 MB
templog LOG 64 MB 64 MB
This confirms the new TempDB file layout is active.
Production sizing guidance
The right TempDB size depends on the workload.
TempDB usage increases with:
- Large sorts
- Hash joins
- Reporting queries
- Index rebuilds
- Snapshot isolation
- Version store usage
- Poorly indexed queries
- Large temporary tables
- Heavy ETL jobs
- Application patterns that use temp objects heavily
For production, monitor TempDB usage before deciding final sizes.
Useful query:
sqlSELECT
SUM(unallocated_extent_page_count) * 8 / 1024 AS free_space_mb,
SUM(version_store_reserved_page_count) * 8 / 1024 AS version_store_mb,
SUM(user_object_reserved_page_count) * 8 / 1024 AS user_objects_mb,
SUM(internal_object_reserved_page_count) * 8 / 1024 AS internal_objects_mb
FROM sys.dm_db_file_space_usage;
Run it during normal business hours and during heavy reporting or maintenance windows.
Where should TempDB live?
For small Windows VPS deployments, TempDB often lives on the default SQL Server data path.
For heavier workloads, consider a separate fast volume if available.
| Setup | Recommendation |
|---|---|
| Small SQL Server Express test VM | Default path is fine |
| Small production SQL workload | Default path may be acceptable |
| Heavy reporting workload | Consider separate fast storage |
| High TempDB write activity | Monitor disk latency |
| Multiple database files and TempDB on same disk | Watch I/O pressure |
A separate TempDB disk can help, but only if the storage actually provides independent performance. Moving TempDB to another folder on the same physical disk may not improve performance.
Autogrowth best practices
Autogrowth is a safety net, not a sizing strategy.
Recommended:
| Setting | Recommendation |
|---|---|
| Data file growth | Fixed MB |
| Log file growth | Fixed MB |
| Percent growth | Avoid |
| All data file sizes | Equal |
| All data file growth settings | Equal |
| File initialization | Consider Instant File Initialization for data files |
Avoid tiny autogrowth values such as 1 MB. They can cause many growth events under load.
Avoid huge growth values on small disks. They can cause long pauses or fill the volume unexpectedly.
Should all TempDB data files be equal?
Yes. Keep TempDB data files equal in size and growth.
If one file is larger than the others, SQL Server may not distribute allocations evenly.
For our 4-file lab layout:
texttempdev 64 MB
tempdev2 64 MB
tempdev3 64 MB
tempdev4 64 MB
For production, the same principle applies even if the files are much larger.
TempDB log file guidance
TempDB usually has multiple data files but one log file.
Start with one TempDB log file unless you have a specific, measured reason to do otherwise.
Focus on:
- reasonable initial size
- fixed autogrowth
- enough free disk space
- monitoring log growth during heavy operations
The TempDB log can grow during large transactions, index operations, or heavy temp table usage.
Common mistakes
Leaving TempDB with one tiny data file
A single small data file may be acceptable for a tiny workload, but production SQL Server often benefits from multiple data files.
Creating too many TempDB files
More files are not always better. Start with one per vCPU up to 8, then monitor.
Using percent autogrowth
Percent growth becomes unpredictable as files get larger. Use fixed MB growth.
Using tiny autogrowth
Small growth increments can create frequent growth events and performance pauses.
Forgetting SQL Server restart
Some TempDB file changes are visible only after SQL Server restarts.
Copying lab sizes into production
Our 64 MB file sizes are for demonstration. Production values should be based on real workload usage.
Ignoring disk space
TempDB can grow quickly during reporting, index maintenance, or query spills. Monitor disk usage.
What Raff recommends
For SQL Server on a Windows VPS, Raff recommends:
- Check the current TempDB layout.
- Check SQL Server CPU count.
- Start with one TempDB data file per vCPU up to 8.
- Keep TempDB data files equal size.
- Use fixed MB autogrowth.
- Pre-size TempDB based on workload.
- Restart SQL Server during a maintenance window.
- Verify the final layout after restart.
- Monitor TempDB usage during real workload.
- Resize the VPS or storage if TempDB pressure is consistently high.
TempDB tuning is not a one-time checkbox. It should be reviewed after workload changes, app releases, reporting changes, and SQL Server migrations.
Tested on
Tested on Raff Windows VPS, Windows Server 2025 Datacenter Evaluation, SQL Server 2025 Express, SQLEXPRESS instance, 4 vCPU, 2026-05-26. We checked the current TempDB layout, verified SQL Server CPU count, added TempDB data files, configured fixed file size and autogrowth, restarted SQL Server, and verified the final TempDB layout. Tester: Serdar Tekin.
What's next
- MSSQL Memory Tuning on a Windows VPS - set max server memory safely
- MSSQL Backup Strategy on a Windows VPS - build full, differential, and log backup routines
- Install MSSQL Server 2025 on a Windows VPS - install and prepare SQL Server on Raff
- Configure Windows Firewall on a Windows VPS - review inbound rules for SQL Server, RDP, and IIS
- Raff Windows VPS - deploy a Windows Server VPS for SQL Server, IIS, business apps, and remote administration
Sources
- Microsoft Learn - TempDB database
- Microsoft Learn - Move system databases
- Microsoft Learn - ALTER DATABASE file and filegroup options
- Microsoft Learn - sys.dm_db_file_space_usage
- Date last verified: 2026-05-29
Related articles
RDP Performance Tuning for Smooth Remote Desktop
Tune Remote Desktop on a Windows VPS by checking RDP connectivity, AVC 444 policy, visual effects, client settings, and server CPU/RAM usage.
IIS Application Pool Tuning for Production on Windows Server
Tune IIS application pools for production on a Windows VPS: idle timeout, AlwaysRunning, No Managed Code, recycling, identity, and memory limits.
MSSQL Memory Tuning on a Windows VPS: Set Max Server Memory Safely
Learn how to set SQL Server max server memory on a Windows VPS, reserve RAM for Windows, and verify the setting with sqlcmd.