Saturday, August 14, 2010

How to find Tables with NO INDEXES...??

Often times when your application is not performing well as it used to, then you start blaming your SQL developer for the bad queries. But this may not be the case all the time. For your application to work fast, you should also have proper indexes in the underlying database.

When your application is not working as fast as it used to, then first check that you might want to do is to check if you have proper indexes in place. One very obvious check that you might want to do will be to indentify tables which are not having any indexes at all. Now how you do that?

Open the SSMS, and check all the tables one by one inside your database..!! Pretty time consuming and so manual, right.

I got this very handy SQL script which will do the job for you very quick. Execute the below script on your database and you will get all the list of all culprit tables.

SELECT name

FROM
sys.tables

WHERE
OBJECTPROPERTY(OBJECT_ID,'TableHasIndex')=0

Hope that you will find this post useful.

Cheers,

No comments:

Post a Comment