Sunday, May 1, 2011

Which is the most efficient way of getting number of rows in a table ?



select COUNT(0) from LiveDataRawString select COUNT(*) from LiveDataRawString SELECT


The last method is the most effiecient method of getting count.
Because display estimated execution plan gives 50%, 50%, 0% costs when all three are evaluated, and gives 99% and 1% when last are evaluated.
rows FROM sysindexes WHERE id = OBJECT_ID('LiveDataRawString') AND indid < 2

No comments:

Post a Comment