Skip to content

SQL Server Database Growth Overview

1. Detailed MetricsSQL Server

UID: sql_server_database_growthVersion: 1.3.1 Panels: ~10 Datasource: MSSQL

Purpose

This dashboard allows you to analyze database and table growth, helping to:

  • Visualize database growth trends
  • Identify abnormal size increases
  • Monitor identities approaching their limit
  • Detect potential shrink candidates
  • Proactive capacity management

Variables

VariableDescription
$Server_NameSQL Server to analyze
$DatabaseSpecific database (or "-- All Databases")
$TableSpecific table (or "-- All Tables")
$DateDate for snapshot visualization

Color Code

ColorCodeMeaning
Green#00db88Correct - Normal
Magenta#ad21d8e8To Check - Review
Red#F2495CWrong - Critical

Space Management Best Practices

Before analyzing the panels, it is essential to understand space management best practices in SQL Server:

File Pre-sizing

  • Appropriate initial size: Configure the initial size of data and log files based on the expected data volume
  • Avoid small files: A very small initial file will cause multiple auto-growths, fragmenting the file at the operating system level
  • Separate data and log: Keep data files (.mdf/.ndf) and log files (.ldf) on different disks when possible

Auto-growth Configuration

  • Avoid percentage growth: A 10% growth on a 100GB database means 10GB of growth, causing prolonged blocking
  • Use fixed values: Configure auto-growth in absolute values (e.g., 256MB, 512MB, 1GB) based on database size
  • Recommended values:
    • Small databases (< 10GB): 256MB
    • Medium databases (10-100GB): 512MB - 1GB
    • Large databases (> 100GB): 1GB - 4GB

Proactive Alerts

  • Configure alerts when free disk space is below 20%
  • Monitor free space within database files
  • Implement alerts for abnormal growth (more than 10% in one day)

Panels

Database Size Treemap

Database Size treemap

Visual representation of each database size on the selected server.

Importance: Database size directly impacts backup/restore times, required storage space, and capacity planning. Identifying which databases consume the most space allows you to prioritize optimization efforts and plan storage expansions.

Treemap

The rectangle size represents the relative size of each database. Useful for quickly identifying the largest databases.


Table Size Treemap

Table Size treemap

Visual representation of table sizes (TOP 20 largest).

Importance: The largest tables usually have the most impact on query performance and index maintenance time. Knowing which ones they are allows you to focus optimization efforts, consider partitioning, or implement data retention policies.


Database Size Evolution

Database Size Over Time timeseries

Evolution of the selected database size over time.

Importance: Growth trend is essential for capacity planning. It allows you to predict when more disk space will be needed and plan storage acquisitions in advance, avoiding emergency situations due to full disks.

Usage

Select a wide time range (30, 60, 90 days) to visualize growth trends and project capacity needs.


Table Size Evolution

Table Size Over Time barchart

Evolution of the selected table size.

Importance: Growth at the individual table level helps identify which processes or applications are generating the most data. It is key for detecting tables that need retention or archiving policies.


Database Daily Growth

Daily Growth barchart

Daily database growth in MB.

Importance: Daily growth allows you to detect patterns (high-load days) and anomalies. An unexpected spike can indicate a massive data load, a log truncation issue, or even malicious data injection.


Abnormal Growth Detection

Abnormal Growth table

Tables that have experienced abnormally high growth.

Importance: Abnormal growth can indicate problems such as uncontrolled data loads, absence of purge policies, or application bugs inserting duplicate data. Early detection prevents disk space exhaustion.

Detection criteria:

  • Growth above the historical average
  • Growth spikes compared to previous days

Identity Columns Near Limit

Identity Near Limit table

Identity columns approaching their maximum value.

Importance: When an identity column reaches its maximum limit, SQL Server throws an overflow error and inserts fail. This can cause a complete service interruption if not detected in time.

Identities at limit

Identity columns approaching the data type limit can cause insertion errors. It is critical to monitor and act before reaching the limit.

Identity types and their limits:

TypeMaximum LimitRecommended Use
TINYINT255Only for very small lookup tables
SMALLINT32,767Catalog tables with few records
INT2,147,483,647Most transactional tables
BIGINT9,223,372,036,854,775,807High-volume tables, logs, auditing

Identity Column Management

Planning Migrations to BIGINT

When an INT column approaches 70-75% of its capacity, it is time to plan the migration to BIGINT:

Considerations before migration:

  1. Space impact: BIGINT takes up 8 bytes vs 4 bytes for INT, doubling the column space
  2. Affected indexes: All indexes that include the column will increase in size
  3. Foreign Keys: All related tables must be updated as well
  4. Migration time: On large tables, the change can take hours and requires additional space in the transaction log

Migration strategies:

  • Maintenance window: For small/medium tables, a direct ALTER TABLE during a maintenance window
  • Parallel migration: Create a new table with BIGINT, gradually migrate data, and perform the swap
  • Third-party tools: Consider tools like pt-online-schema-change (adapted for SQL Server) for very large tables

Recommended alert thresholds:

Percentage usedAction
< 50%No action
50-70%Document and plan
70-85%Schedule migration
85-95%Urgent migration
> 95%Emergency

Shrink Candidates

Shrink Candidates table

Databases with potentially recoverable space.

Importance: Identifying unused space within database files helps understand storage usage efficiency. However, the decision to shrink should be taken with extreme caution.

Considerations about Shrink

Although shrink can free up space, it has side effects:

  • Causes index fragmentation
  • Consumes I/O resources
  • The space usually grows back

Only perform shrink when absolutely necessary and plan an index rebuild afterward.

Why SHRINK is almost always a bad idea

DBCC SHRINKDATABASE and DBCC SHRINKFILE are operations that should be avoided in production environments.

Problems caused by shrink:

  1. Massive index fragmentation: Shrink moves pages from the end of the file to the beginning, causing severe fragmentation (often 90%+) in all affected indexes

  2. Performance impact: During shrink, database performance degrades significantly due to intensive I/O

  3. Vicious cycle: After shrink, when data grows again, files expand again, and the "recovered" space is lost

  4. Blocking: Shrink can cause blocking on affected tables during the operation

  5. Wasted resources: The time invested in shrink + index rebuild usually exceeds the benefit of recovered space

When it might be acceptable:

  • After permanently deleting a large amount of data that will NOT grow back
  • After moving large tables to another database or filegroup
  • In development/test environments where performance is not critical
  • As preparation for a migration where file size is a limiting factor

Alternatives to shrink:

  • Correctly pre-size files from the start
  • Implement data retention and purge policies
  • Consider partitioning to move historical data
  • If free space is excessive, investigate the root cause instead of treating the symptom

Interpretation Guide

Growth Analysis

PatternInterpretationAction
Linear growthNormal, predictablePlan capacity
Sudden spikeData load, importInvestigate cause
Exponential growthPossible problemReview purge processes
No growthNormal or no activityVerify activity

Capacity Planning

To project space needs:

  1. Analyze trends: Use the evolution panel with 90+ days of data
  2. Calculate growth rate: Average MB/day
  3. Project needs: Current space + (rate * days until next review)
  4. Plan with margin: Add 20-30% buffer

Stored Procedures Used

ProcedureDescription
[TablesControl].[spDatabaseSize]Database size evolution
[TablesControl].[spTablesSize]Table size evolution

Tables Used

TableDescription
sys_databasesDatabase catalog
sys_master_filesDatabase files
[dbo].[hc_table_size]Historical table size

Recommendations

Growth Monitoring

  1. Review weekly: Analyze growth trends
  2. Proactive alerts: Configure alerts when free space is < 20%
  3. Retention policies: Implement historical data purging
  4. Partitioning: Consider for very large tables

Identity Management

  1. Monitor regularly: Review columns that exceed 75% of the limit
  2. Plan migration: Change to BIGINT before reaching the limit
  3. Reseeding: In exceptional cases, consider restarting the sequence

Microsoft References

To delve deeper into file management and capacity planning concepts, consult the official documentation: