Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 large table size

Author  Topic 

jeff06
Posting Yak Master

166 Posts

Posted - 2008-08-27 : 16:29:55
I have very large table (I guess it is large)

select count(*)
from largetb

after 10 mins, it is still runing.
Is there a better way to find the size for very large table?
Thanks.
Jeff

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-27 : 16:47:04
You are probably being blocked. Check for blocks using sp_who/sp_who2/sysprocesses.

You could just right click on the database though and go to reports, view the one called "Disk usage by top tables".

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-08-27 : 16:48:27

use sp_spaceused 'tablename' for size as well as rowcount.
Go to Top of Page

jeff06
Posting Yak Master

166 Posts

Posted - 2008-08-27 : 17:01:22
the table has more than 100 millon obs and it takes 27 mins for the counting process. Is it normal?
Thanks.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-08-27 : 17:03:43
Right click table properties, you can see Row count(But that won't be exact if there is loading happening)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-27 : 17:04:07
27 minutes is not normal. Do you have a clustered index on the table?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-28 : 03:14:39
If you want to know approximate count, use

select rows from sysindexes where indid<2 and object_name(id)='your table'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -