How To Find Table and Index Sizes in SQL Server

Sometimes we need to list table sizes in SQL Server. For example, we need to find large tables before we start making Compression or before deciding which tables to partition. You can find table sizes using the following script.

You may want to read the following articles about Compression and Partition.

SQL Server Compression“,

How To Create Partition On SQL Server“,

Sliding Window-Switch Partition-Split Range-Merge Range“,

How To Find Partitioned Tables In The Database On SQL Server

Descriptions of the columns specified in Script;

In the Total_SizeKB column, it shows the total size of the data in the table (excluding index),

In the Used_SizeKB colum, it shows how much of the total size is used.

In the Unused_SpaceKB column, it shows how much of the total size has not yet been used.

If you want to list the index sizes in the same query, you can use the following script.

dbtut
Author: dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *