COUNT(*) for larger tables
- Posted by Sqltimes
- On November 16, 2013
- 0 Comments
Quick one:
As I wrote in one of my previous posts, I am not a fan of running COUNT(*) on any table. I prefer these alternative methods that depend on meta data rather than running a scan on table just to get a count. No matter the size of the table, you can get the row count using meta-data view.
This post is only about COUNT_BIG(*), so:
When you need to perform COUNT(*) on tables that have more than 4 billion rows (or 2 billion if they only use positive integers [greater than 0]), you need BIGINT version of the COUNT(*).
1
2
3
|
SELECT COUNT (*) FROM DBA.TableName -- smaller tables SELECT COUNT_BIG(*) FROM DBA.TableName -- very large tables |
Hope this helps,
_Sqltimes
0 Comments