Storage measures the percentage of your max file storage that is in use. The max storage is easily confused with the allocated storage but they are different. Allocated storage is the amount of file storage that has been formatted and is writable by your database, and is automatically increased as more storage is needed, up to the maximum amount of storage. Blue Matador automatically monitors the storage_percent metric for high usage.



    Reaching max storage will prevent your database from storing additional data.


    Increasing Max Storage

    For single databases, the max storage can be configured as part of your database configuration. If your max storage cannot be increased further, you may need to upgrade your database to the next service tier. 

    For databases that are part of an elastic pool, max storage can be increased up to the maximum allowed by the elastic pool. If the elastic pool is also at max storage, then it must be configured for more storage before any of its databases can increase max storage. This also may require upgrading to a higher service tier for your elastic pool.


    Reducing Used Storage

    If you can identify specific databases where you would like to reduce storage used, you can use the DBCC SHRINKDATABASE command as documented here. Using SHRINKDATABASE will severely impact database performance and should only be used during periods of low database activity. 

    You can also enable Auto-Shrink to reduce database size. Auto-Shrink is less impactful than SHRINKDATABASE but also less effective. You can enable Auto-Shrink with the following SQL:

    -- Enable auto-shrink for the database.

    After shrinking a database you may need to rebuild indexes if your performance degrades. You can follow the documentation here to rebuild your indexes in your SQL database.