Search
| Login
corner corner
Relevant Links
corner corner
corner corner
Subscribe To Feed
corner corner
corner corner
Search Articles
corner corner
corner corner
Topics
corner corner
corner corner
Article List
corner corner
corner corner
Article Archive
corner corner
corner corner
Survey
Which platform does your company use?



Submit Survey  View Results
corner corner
corner corner
Relevant Links
corner corner
corner corner
Get Approximate Row Count Fast on SQL Server
Location: BlogsCubicZoneSQL    
Posted by: cubiczone 9/26/2008 4:51 AM

Row count can be extremely long for very tables with thousands or millions of rows. SQL Server is already optimized to count from the index instead of counting from the data table, but the operation can still take seconds, if not minutes to complete. If you don't need the exact number of rows, you can use the following query to get an approximate row count quickly on SQL Server:

SELECT rowcnt FROM sys.sysindexes WHERE id = OBJECT_ID('TABLE_NAME') AND indid < 2

where TABLE_NAME is the name of your table.

 

Permalink |  Trackback

Your name:
Title:
Comment:
Add Comment   Cancel 
corner corner