Domanda

Say I create a nonclustered index on a table. After a week I look at the sats, e.g. number of seeks, scans, updates etc. E.g. say I have 10 seeks and 10000 updates. How can I measure the cost of the 10000 updates? That is how can I measure the cost of the 10000 updates on the nonclustered index vs 10 extra scans on the clustered index?

I want to learn when the cost of having the index is more than the benefit. How do I measure this?

È stato utile?

Soluzione

What I would do is

SET STATISTICS IO ON

and then I would test the SELECT statement that produces the seek and the UPDATE statement.

Finally, I would compare the number of pages read by the SELECT with the number of pages written by the UPDATE.

But in general this ratio between seek and updates seems to suggest that your nonclustered index is not valuable. But it really depends on your query needs.

Altri suggerimenti

It really depends on ... what fields, how big index etc.... The ratio is not great but ... Is it a simple logging table with insert only? how often do you insert vs how often do you query. If you query only once a week but do a big select on a multimilion wide table then even the 10 index scans can be ok..... To summarize, I would ask what select is running and using the index and what is the performance without the index.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange
scroll top