SQL Server: Find the total row count and size of the Tables

In this post, I am providing different scripts to find row count, occupied space, free space, page and extent information of the SQL Server Tables.

The first step for performance optimization is to measure the size of tables with different information like, number of pages and extents, row size, free space.

Below are different scripts to find table related information.

Using DBCC SHOWCONTG, find average row size, page and extent information:

Using sp_spaceused, find row count, index size, data size, unused space:

T-SQL Script for all tables:

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz