x
login about faq Site discussion (meta-askssc)

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 19 22 26

(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 13 17 19

(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.

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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x17
x12
x7

asked: Oct 26 '09 at 02:08 AM

Seen: 1288 times

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

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.