SQL Database Space by File Groups Test
Typically, SQL Server databases have three types of files, as shown in the following table.
File | Description |
---|---|
Primary |
The primary data file contains the startup information for the database and points to the other files in the database. User data and objects can be stored in this file or in secondary data files. Every database has one primary data file. The recommended file name extension for primary data files is .mdf. |
Secondary |
Secondary data files are optional, are user-defined, and store user data. Secondary files can be used to spread data across multiple disks by putting each file on a different disk drive. Additionally, if a database exceeds the maximum size for a single Windows file, you can use secondary data files so the database can continue to grow. The recommended file name extension for secondary data files is .ndf. |
Transaction Log |
The transaction log files hold the log information that is used to recover the database. There must be at least one log file for each database. The recommended file name extension for transaction logs is .ldf. |
All data files are stored in the filegroups listed in the following table.
Filegroup | Description |
---|---|
Primary |
The filegroup that contains the primary file. All system tables are allocated to the primary filegroup. |
User-defined |
Any filegroup that is specifically created by the user when the user first creates or later modifies the database. |
If even a single file group in a database runs out of free space, serious performance degradations will be noticed in applications that depend on that file group for their data needs. To avoid this, administrators must track space usage both at the database-level and at the individual file group-level and proactively identify those file groups that are over-utilized. The SQL Database Space test provides administrators with both these usage insights. By monitoring the space usage in each SQL database, the test points administrators to those databases that are consuming too much space and reveals the type of data that is hogging space – data in tables? Or indexes? Alongside, the test also reports usage metrics for each file group in every SQL database, and accurately pinpoints those file groups that may soon fill up the disk! This way, the test turns the spotlight on databases and file groups that may have to be resized to ensure peak application performance.
Note:
This test will report metrics for file groups only if Microsoft SQL Server 2008 R2 (and above) is monitored.
Target of the test : A Microsoft SQL server
Agent deploying the test : An internal agent
Outputs of the test : One set of results for every Microsoft SQL server database and every file group in each database
|
Measurement | Description | Measurement Unit | Interpretation | ||||||
---|---|---|---|---|---|---|---|---|---|
Total size: |
The space allocated to a database. |
MB |
The Total size does not include the size of the database log files. This measure is reported only for a database. |
||||||
Reserved space percent: |
The percentage of allocated space reserved for tables and indexes of a database |
Percent |
If the value of this measure reaches 100%, it indicates that the total space in the database has been completely allocated. New tables/indexes can be added to the database, only if its total size is increased. This measure is reported only for a database. |
||||||
Reserved space: |
The amount of allocated space reserved for the tables and indexes created on a database |
MB |
If the value of this measure becomes equal to that of the Total size measure, new tables/indexes can no longer be created on the database. To create new tables, you must increase the database size. This measure is reported only for a database. |
||||||
Data space: |
The amount of allocated space used by data in tables. |
MB |
The total allocated space that is in use in a database is the sum of the value of the Data space and Index space measures. This measure is reported only for a database. |
||||||
Index space: |
The amount of allocated space used by indexes. |
MB |
|||||||
Unused space: |
The amount of allocated space that is available for use in the database |
MB |
This is the difference between the Total size and Reserved space. This measure is reported only for a database. |
||||||
Is auto-growth enabled? |
Indicates whether/not auto-growth is enabled for this file group. |
Boolean |
This measure is reported only for file groups. Auto-growth is the process by which the SQL Server engine expands the size of a database file when it runs out of space. The amount by which a database file grows is based on the settings that you have for the file growth options for the data file. If this setting is enabled for even one file in a file group, this measure will report the value Yes. If this setting is not enabled for any of the database files in a file group, then this measure will report the value No. The numeric values that correspond to the above-mentioned measure values are listed in the table below:
Note: Typically, this measure reports the Measure Values listed in the table above as the status of the Autogrowth setting. In the graph of this measure however, the status will be represented using the numeric values – i.e., 100 and 0. |
||||||
Max file size: |
Indicates the maximum size up to which the database files in this file group can grow. |
MB |
This measure is reported only for file groups. Each database file that is associated with your database has an auto-growth setting. There are three different settings you can use to identify how your database files will grow. They can grow by a specific size, a percentage of the current size, or not grow at all. Additionally you can set your files to unrestricted growth, which means they will keep growing as they need more space or you run out of disk space. Or you can restrict the growth of a database file to grow no larger than a specified size. Each one of these different auto-grow settings have defaults, or you can set them for each database file. If the auto-growth setting is not enabled at all for a file in a file group, then the amount of space that was originally allocated to that file will be regarded as the Max file size of that file. On the other hand, if the Auto-growth setting is enabled for a file in the file group, then the Max file size of that file will be one of the following:
So, if a file group consists of a few data files for which auto-growth is enabled and a few others for which it is disabled, then the Max file size of that file group will be a sum total of the following:
|
||||||
Free space: |
Indicates the amount of disk space that is currently available for use for this file group. |
MB |
This measure is reported only for file groups. A high value implies that the database files in the file group have adequate disk space for growth. If the value of this measure is low, then you may have to fine-tune your auto-growth settings accordingly. |
||||||
Percentage of free space: |
Indicates the percentage of Max file size that is currently available for use for this file group. |
Percent |
This measure is reported only for file groups. This measure reports the Free disk space value as a percentage of Max file size. In other words: Free disk space/Max file size * 100 If many files in a file group are set to auto-grow till disk capacity is reached, then, a high value of this measure indicates that there is enough space for the files to grow. A low value indicates that there is very little room for file growth. |