How to check SQL Server Database Size and Log Size

Next →

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 will show a brief detail about a database.

sp_helpdb 'master'

How to find Database File Size and Log File Size in SQL Server

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.

Must Read: Improve your SQL Server database performance by doing this

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.

Also Read: How to show date and time as Blank instead of 1900-01-01 in SQL Server

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.

Next →