Wednesday, 1 February 2012

Which query will be fast to give the records

SQL Query - 1:
SELECT COUNT(*)FROM TableName





SQL Query - 2:
SELECT rows FROM sysindexes WITH (NOLOCK) WHERE id = OBJECT_ID('TableName') AND IndId < 2


SQL Query - 3:
SELECT COUNT(*)FROM TableName where id=101





 

1 comment:

  1. As per my knowledge..
    Sql query-2: will be fast.But known the deep concept.
    If any one knows that better to me then post the Comment.

    ThanKs!!
    Ashish Verma

    ReplyDelete