December 6, 2019 at 3:45 am
sys.dm_db_missing_index_details shows we need to create an index based on the columns under equality_columns or inequality_columns plus included_columns information,
now I have some questions about this one,
1. do you often refer to (or use) the information of this table to create or alter index ?
2. if we seldom create/alter index based on this inforamtion, can we say it not big practical value to us?
sys.dm_db_index_usage_stats shows the numbers of usage of index about user_seeks/ user_scans / user_lookups and user_updates , about these informations, I have questions below, thanks!
3. Can we use the the numbers of usage of index about user_seeks/ user_scans / user_lookups to change the index on the table ? if ok, how can we change this present indexs using these information ?
if there is a certain number to show need to change present indexs while user_scans is much higher than the user_seeks ?
4. what does it mean about the field of user_updates ?
5. if user_updates is much higher than the user_seeks, can we say this index unhelpful ?
December 6, 2019 at 8:28 am
John
December 6, 2019 at 3:08 pm
Now, if you really want to use the missing index information, I'd suggest querying the execution plans, either through the Query Store or the plan cache. This way, you can correlate the missing index suggestions (and they are VERY much suggestions, not hard and fast good indexes) with an actual query and query performance metrics. Just remember to evaluate the suggestions and test them thoroughly before implementing them. I've seen the missing index suggestions be extremely poor and/or repetitive with existing indexes. I don't trust them even as I use them regularly when tuning.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
December 6, 2019 at 6:28 pm
You also have to remember that, on sys.dm_db_index_usage_stats, things may not be as they seem. For example, you might have 1 "UserRead" (UserSeek, UserScan, UserLookup) per day and tens of thousands of UserUpdates. That doesn't mean that the index isn't perfect. 1 "UserRead", in this case, is due to one query that used the index. It could have processed a million rows but will still show up as 1 "User Read". The same goes for the UserUpdates. It may very well be that each update was just 1 row at a time and so the number seems inordinately high compared to the "UserReads" (whatever form they take).
As both John and Grant have indicated, the contents of that "DMV" provide information to make decisions based on a lot of additional information. About the only thing that you can derive directly from the table is that if the SQL Service hasn't been rebooted for more than a month, the index has existed for at least that period of time, and there are no UserUpdates, there's a really good chance that the table is static. Even then, you could end up with a table that's only updated once per quarter or even once per year.
As Sergiy once said to me, "A Developer must not guess... a Developer must know" and all either of the two items in the title of this post will actually do for you is to provide additional information to help you guess less.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 7, 2019 at 1:26 am
Thanks John ?Grant and Jeff for you kind help and benefit much from your suggestions! thanks!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply