SELECT COUNT(*) AS ROWS FROM MY_TABLE
Now what should we do? What is the optimize query? These are the questions might be coming in your mind, ok, below given is the optimized query that you guys must use for counting records purpose.
SELECT ROWS FROM SYSINDEXES WHERE ID = OBJECT_ID('MY_TABLE') AND INDID < 2That's it. Hopefully you will find this tutorial very helpful. I love to hear your feedback.