SQL Server Engineering

Database File Growth: Capacity Before Autogrowth

Distinguish allocated size, internal free space, and volume capacity, then choose predictable growth increments and actionable alerts.

A database can run out of room while its data file still looks small, or trigger a disk alert while holding plenty of reusable space inside a large file. File allocation, data usage, and filesystem capacity answer different questions. A capacity plan has to measure all three before deciding whether another growth event is safe.

Read the current allocation correctly

The query reports rowstore file allocation and approximate allocated-page usage in the current database. FILEPROPERTY SpaceUsed concerns pages allocated within a data file; it is not the same as operating-system free space or the logical payload size of table rows. Log space needs its own measurements and reuse analysis.

SELECT name,type_desc,size/128.0 AS AllocatedMB,
 CASE WHEN type=0 THEN FILEPROPERTY(name,'SpaceUsed')/128.0 END AS UsedMB,
 CASE WHEN type=0 THEN (size-FILEPROPERTY(name,'SpaceUsed'))/128.0 END AS InternalFreeMB,
 is_percent_growth,growth,
 CASE WHEN is_percent_growth=0 THEN growth/128.0 END AS FixedGrowthMB,
 max_size
FROM sys.database_files;

A percentage growth setting makes the next increment depend on the current file size. Ten percent of a small file and ten percent of a multi-terabyte file are very different operational events. A fixed increment makes the next request easier to budget, but there is no universally correct number of megabytes for every workload.

Check physical capacity separately. The volume query can return the same volume for multiple files, so do not add its available bytes once per row. Shared volumes may also serve other databases or applications. In virtualized storage, the filesystem's apparent free space is only one layer of the capacity picture.

SELECT f.name,v.volume_mount_point,
 v.total_bytes/1073741824.0 AS VolumeGB,
 v.available_bytes/1073741824.0 AS AvailableGB
FROM sys.database_files AS f
CROSS APPLY sys.dm_os_volume_stats(DB_ID(),f.file_id) AS v;

Treat autogrowth as a reserve mechanism

Pre-size files for expected near-term demand and retain autogrowth as protection against forecast error. Frequent small growth events add overhead and can interrupt work. Very large growth events can take longer or consume the reserve needed by other files. Choose increments from observed growth rate, allocation duration, and available capacity.

Data-file growth and log-file growth behave differently. Reusable data-file space can satisfy new allocations without another filesystem extension. A log may remain unable to reuse space because of a long transaction, missing log backups under the applicable recovery model, or another log-reuse wait. Adding capacity can restore breathing room without fixing that underlying condition.

Instant file initialization may reduce data-file initialization time when applicable, but it does not create disk capacity or eliminate all growth work. Do not assume log growth follows the same behavior across versions and sizes. Measure the actual operation in a comparable environment.

Alert on the next failure, not one percentage

Monitor free bytes within data files, filesystem reserve, growth rate, configured maximum size, and growth failures. Estimate how long the remaining reserve will last under both ordinary and peak demand. A low percentage on a very large volume can still be ample; a high percentage on a tiny volume can disappear in minutes.

Include scheduled operations in the forecast. Index creation, rebuilds, bulk loads, and temporary staging may need space beyond normal steady-state growth. Their data, log, and tempdb requirements can arrive together. A maintenance plan that checks only the target data file misses those concurrent demands.

Avoid routine shrink-and-grow cycles. Shrinking after every maintenance operation can return space only to require it again, adding work and disrupting a stable allocation plan. Consider shrink only for a justified, durable reduction and evaluate its operational consequences separately.

Validate the plan by comparing predicted and observed allocation over time. Record growth-event duration and the workload impact, not only whether growth succeeded. A useful alert identifies the constrained file or volume, the next expected increment, and enough remaining time for a planned response.

Technical references: Microsoft Learn: Database files · Microsoft Learn: Volume statistics.

Ask about this article

Have a question about this topic?

Tell us what you are evaluating or where you are stuck. We will respond with a practical recommendation.

Inquiries are not enabled in this preview.

Ask a question about this article