Faster way to get row count from a view than select Count(*) from ViewObject?

Charles Baldo
Charles Baldo used Ask the Experts™
on
Is there a faster way to get a row count from a view than select count(*) from ViewName??

Migrating a massive, humongous doc management system out of SQL 2005 and need to get row counts. Almost a billion records and the last count took 20 minutes.

"No" is an acceptable answer if you are 100% sure.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Engineer
Distinguished Expert 2017
Commented:
If the view is indexed you can get a non accurate number from the sys.sysindexes:
SELECT rows
FROM sys.sysindexes
WHERE id = object_id('ViewName')

Open in new window

NOTE: Is not accurate because the column is only updated when an index is created or during a reindex.
Charles BaldoSoftware Developer

Author

Commented:
It is thanks, close is good enough as well, the database is static and not changing now.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial