x

Finding the Table Size

Is there is a way to find out the size of a table i.e know which is the biggest table in the database apart from doing a row count and deducing the size ?

more ▼

asked Oct 26 '09 at 02:08 AM in Default

Sagar Bhargava gravatar image

Sagar Bhargava
358 23 25 27

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Try this:

SELECT object_name(object_id) as objectname, SUM(used_page_count) * 8192. / 1024 / 1024 as pages_used_MB FROM sys.dm_db_partition_stats GROUP BY object_id ORDER BY SUM(used_page_count) DESC; 
more ▼

answered Oct 26 '09 at 02:15 AM

Rob Farley gravatar image

Rob Farley
5.7k 15 18 20

(comments are locked)
10|1200 characters needed characters left

I use this script : Monitoring Table Growth with PowerShell In fact it shows you the rate of growth existing in each table, at each database of each server. But in the TOTAL column you have the size of it with the sum of IndexSpaceUsed + DataSpaceUsed for each table

Actually for what you said, Rob has put the best way. I voted for him .. But If you want an automated routine and that will show you beyond the size, growth rate of each table..there is..and works fine...

more ▼

answered Oct 26 '09 at 02:17 AM

Laerte Junior gravatar image

Laerte Junior
488 2

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x21
x12
x7

asked: Oct 26 '09 at 02:08 AM

Seen: 1633 times

Last Updated: Oct 29 '09 at 01:17 PM