Do you have unused index? Do you have ineffective index? How many times was it used for select or update?
Is it used by scan , seeks or lookups?
Index usage statistics :
Just another Select of Ms SQL DBA site
Do you have unused index? Do you have ineffective index? How many times was it used for select or update?
Is it used by scan , seeks or lookups?
Index usage statistics :
I do it for registered servers:
You can often check the index defragmentation. It is useful if you start checking with the biggest table, because the biggest effect is there.
I like to check the indexes with the creation and modification date. If you rebuild the index your index modification date will be updated.
If you want to see for all database you can replace the
with
in the script.
I use two script. The firs one is for general purpose and run faster, the second one is good for partitioned table and get many details about partitioned index and table.
Detailed query for partitioned table:
Egy több millió sorral rendelkező táblán már súlyos gondokat okozhat egy-egy index hiány.
5 Millió sor, paraméterezett select, a szerver túlterhelt:
11:20-kor 1 db index felrakása után látványosan csökken a CPU (kék) és CPU Queue (piros). Ellenpróba 13:35-kor az index letiltásakor ismét befullad a szerver (a határértéknek számító 80%-ról 95% átlagos cpu használatra ugrik). Ráadásul a szerveren több mint 100 adatbázis van és mégis egy darab eljárás jelentősen beterhel.
Persze a valóság nem ilyen egyszerű, egy -egy index felrakásának hatását többnyire nem lehet performance monitor-ból kimutatni, a fenti példa egy rosszul tervezett gyakori futású kódra vonatkozik.
Index size
Az egyes indexek méretei. Az adott adatbázisra kell használni, szükség esetén szűrni.