• Pricing
  • Performance
  • About Us
PricingPerformanceAbout Us
Sign InSign Up
  • Pricing
  • Performance
  • About Us
PricingPerformanceAbout Us
Sign InSign Up
Sign InGet Started

High-Performance Cloud Infrastructure

Empowering businesses with enterprise-grade cloud solutions at competitive prices. Built for reliability and simplicity. Designed for growth.

SOC 2 Compliant
ISO 27001
99.9% Uptime

Stay Updated

3000+

Customers

15,000+

VMs Deployed

24/7

Human Support

Products

Build

  • Raff VM
  • Raff Windows VM
  • Raff Apps
  • Kubernetes

Templates

  • Linux VM
  • Forex VM
  • n8n VM

Store

  • Raff S3
  • Raff Databases

Support

  • Documentation
  • API Reference
  • CLI
  • Terraform Provider
  • Contact
  • FAQ
  • Status

Company

  • About
  • Pricing
  • Blog
  • Release Notes
  • Performance
  • Status

Account

  • Sign In
  • Sign Up
  • Reset Password

Legal

  • Terms of Service
  • Privacy Policy
  • Service Level Agreement
  • Acceptable Use Policy

© 2026 Raff Technologies. All rights reserved.

System Status
SQL Server & Databases
SQL Server & Databasesintermediate8 min read·Updated May 29, 2026

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.

Serdar Tekin
Serdar Tekin
Co-Founder & Head of Infrastructure
Genuine, fully-licensed Windows
Spin up a Windows Server: full admin, RDP-ready
Genuine Windows Server 2019, 2022, or 2025 with full administrator access. We handle the Microsoft licensing, billed monthly with nothing to buy upfront.
Deploy Windows NowLearn MoreTalk to Windows Engineer
Verified TempDB layout after adding multiple data files and fixed autogrowth settings on a Raff Windows VPS.

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

SituationRecommended action
Fresh SQL Server installCheck current TempDB file layout
2-8 vCPU Windows VPSStart with one TempDB data file per vCPU, up to 8 files
Files use percent autogrowthChange to fixed MB autogrowth
TempDB files are tinyPre-size them to avoid constant growth
SQL Server workload uses sorting/reporting heavilyMonitor TempDB usage and spills
Production serverChange TempDB during a maintenance window
SQL Server Express test VMUse 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.

PowerShell output showing a Raff Windows VPS running Windows Server 2025 with SQL Server SQLEXPRESS service available for TempDB testing.

Test environment:

ItemValue
ProviderRaff Technologies
OSWindows Server 2025 Datacenter Evaluation
SQL ServerSQL Server 2025 Express
InstanceSQLEXPRESS
CPU4 vCPU
Test databaseTempDB system database
Test date2026-05-26
TesterSerdar 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:

Powershell
sqlcmd -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;"

sqlcmd output showing SQL Server edition and version information for a SQLEXPRESS instance. Review:

ColumnMeaning
nameLogical file name
type_descROWS for data file, LOG for log file
physical_nameFile path on disk
size_mbCurrent file size
growth_mbAutogrowth size
is_percent_growthWhether 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:

Powershell
sqlcmd -S .\SQLEXPRESS -E -C -Q "SELECT cpu_count, scheduler_count FROM sys.dm_os_sys_info;"

sqlcmd output showing SQL Server CPU count and scheduler count used for TempDB file planning.

For our 4 vCPU test VM, a reasonable baseline is:

Text
4 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 countStarting TempDB data files
1 vCPU1 file
2 vCPU2 files
4 vCPU4 files
8 vCPU8 files
16+ vCPUStart 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:

  1. Estimate typical TempDB usage.
  2. Pre-size files so normal workload does not trigger growth.
  3. Use fixed MB autogrowth.
  4. Keep all TempDB data files the same size.
  5. Keep all TempDB data files with the same growth setting.

For the lab, we used small values:

File typeLab sizeLab growth
TempDB data files64 MB each64 MB
TempDB log file64 MB64 MB

For production, common starting values may be larger:

WorkloadStarting data file size
Small app / dev256 MB - 1 GB each
SMB production app1-4 GB each
Reporting-heavy workloadBased on observed usage
Large SQL workloadSize from monitoring and testing

Do not copy lab sizes into production without checking workload needs.

Don’t have a server yet?

Deploy Windows NowLearn MoreTalk to Windows Engineer

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.

Powershell
sqlcmd -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);"

sqlcmd output showing ALTER DATABASE commands applied to resize TempDB files and add additional TempDB data files.

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:

Powershell
Restart-Service -Name 'MSSQL$SQLEXPRESS' -Force

Then verify the service is running:

Powershell
Get-Service -Name 'MSSQL$SQLEXPRESS'

PowerShell output showing the SQL Server SQLEXPRESS service restarted and running after TempDB configuration changes.

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:

Powershell
sqlcmd -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:

Text
tempdev 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

sqlcmd output showing the verified TempDB layout after restart with multiple data files and fixed autogrowth settings. 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:

Sql
SELECT 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.

SetupRecommendation
Small SQL Server Express test VMDefault path is fine
Small production SQL workloadDefault path may be acceptable
Heavy reporting workloadConsider separate fast storage
High TempDB write activityMonitor disk latency
Multiple database files and TempDB on same diskWatch 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:

SettingRecommendation
Data file growthFixed MB
Log file growthFixed MB
Percent growthAvoid
All data file sizesEqual
All data file growth settingsEqual
File initializationConsider 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:

Text
tempdev 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:

  1. Check the current TempDB layout.
  2. Check SQL Server CPU count.
  3. Start with one TempDB data file per vCPU up to 8.
  4. Keep TempDB data files equal size.
  5. Use fixed MB autogrowth.
  6. Pre-size TempDB based on workload.
  7. Restart SQL Server during a maintenance window.
  8. Verify the final layout after restart.
  9. Monitor TempDB usage during real workload.
  10. 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
Was this article helpful?

Published May 29, 2026 · Updated May 29, 2026

Back to hub
Get started
Deploy a Windows Server

Genuine, fully-licensed Windows. Full admin, RDP-ready in ~55 seconds.

Deploy Windows Now
Full admin · RDP-ready · 14-day money-back
On this page
In shortQuick verdictWhy TempDB mattersWhat we tested on RaffStep 1 - Check current TempDB layoutStep 2 - Check CPU count for file planningRecommended TempDB file countStep 3 - Choose file size and autogrowthStep 4 - Apply TempDB configurationStep 5 - Restart SQL ServerStep 6 - Verify TempDB layout after restartProduction sizing guidanceWhere should TempDB live?Autogrowth best practicesShould all TempDB data files be equal?TempDB log file guidanceCommon mistakesWhat Raff recommendsTested onWhat's nextSources
Ready when you are

Your Windows Server, live in ~55 seconds

Genuine, fully-licensed Windows with full admin and RDP. We handle the Microsoft licensing, billed monthly with nothing upfront. On NVMe SSD, backed by a 14-day money-back guarantee.

Deploy Windows Now
Learn MoreTalk to Windows Engineer

Related articles

SQL Server & DatabasesAlways On Availability Groups on Two Windows VPSesLearn how to plan and set up SQL Server Always On availability groups on Windows Server VPS infrastructure, including WSFC, SQL editions, replicas, listener, quorum, seeding, failover tests, backups, and common mistakes.10 min read7/6/2026SQL Server & DatabasesMSSQL Standard vs Enterprise — When to Pay MoreCompare SQL Server Standard and Enterprise for Windows VPS workloads, including SQL Server 2025 limits, licensing, high availability, and when Enterprise is worth paying for.8 min read5/29/2026SQL Server & DatabasesMSSQL Backup Strategy on a Windows VPS: Full, Differential, and Log BackupsBack up SQL Server on a Windows VPS with a practical strategy for full, differential, and log backups, off-server copies, retention, and restore testing.10 min read5/26/2026