Last Updated: 17th November 2026
Why is the data execution so slow? Many ask this question when they discover that their online data execution is very slow, irrespective of a good internet speed. The answer to this question sometimes lies in the size of the database and its log file in particular.The below query provides database information, including database file sizes and growth settings.
sp_helpdb 'master'

The size of your SQL Server database log file sometimes, determine the performance of a database and if you have been allocated limited space for hosting a database driven website, then you must be very careful while managing your database.
Remember
Log files consume lot of space when you perform bulk inserts, updates or deletes. Depending upon the size of your SQL command, the log file will consume space allocated to you.
Here's another script that you can use to check the database properties. Run the below script on the local database.
SELECT database_id, DB_NAME(database_id) DatabaseName, Name AS FileName, physical_name AS FilePath, (size*8)/1024.0 AS [FileSize (MB)] FROM sys.master_files WHERE DB_NAME(database_id) = 'master'
Note: Your service provider may not give you the permission to view the sys.master_files.
Check database file size, log file size, and actual space usage
If your objective is to check database file size, log file size, and actual space usage, then I will recommend this query.
SELECT DB_NAME() AS DatabaseName, name AS LogicalFileName, type_desc AS FileType, physical_name AS PhysicalFilePath, CAST(size * 8.0 / 1024 AS DECIMAL(18,2)) AS AllocatedSize_MB, CAST( (size - FILEPROPERTY(name, 'SpaceUsed')) * 8.0 / 1024 AS DECIMAL(18,2) ) AS FreeSpace_MB, CAST( FILEPROPERTY(name, 'SpaceUsed') * 8.0 / 1024 AS DECIMAL(18,2) ) AS UsedSpace_MB, CASE WHEN is_percent_growth = 1 THEN CAST(growth AS VARCHAR(20)) + '%' ELSE CAST(growth * 8.0 / 1024 AS VARCHAR(20)) + ' MB' END AS AutoGrowth FROM sys.database_files;
The above query provides, database file name, data or log file identification, physical file location, allocated file size, used space, free space, and autogrowth configuration.
Check Transaction Log Usage
SQL Server provides a dedicated Dynamic Management View (DMV). See this query.
SELECT DB_NAME(database_id) AS DatabaseName, total_log_size_in_bytes / 1024.0 / 1024 AS TotalLogSize_MB, used_log_space_in_bytes / 1024.0 / 1024 AS UsedLogSpace_MB, (total_log_size_in_bytes - used_log_space_in_bytes) / 1024.0 / 1024 AS FreeLogSpace_MB, used_log_space_in_percent AS UsedLogSpace_Percentage FROM sys.dm_db_log_space_usage;
A Final Word
Before submitting and hosting a database driven website, plan your database properly to make sure it does not trouble you in the future.
