October 27, 2016 at 10:39 am
Hi,
Previous DBA used DTA to create allot of indexes.
I though DTA indexes always skipped (not used) by queries?
But when I run this:
SELECT OBJECT_NAME(S.[OBJECT_ID]) AS [OBJECT NAME],
I.[NAME] AS [INDEX NAME],
USER_SEEKS,
USER_SCANS,
USER_LOOKUPS,
USER_UPDATES
FROM SYS.DM_DB_INDEX_USAGE_STATS AS S
INNER JOIN SYS.INDEXES AS I ON I.[OBJECT_ID] = S.[OBJECT_ID] AND I.INDEX_ID = S.INDEX_ID
WHERE OBJECTPROPERTY(S.[OBJECT_ID],'IsUserTable') = 1
AND S.database_id = DB_ID()
I see values for 'user_updates, scans, etc'
I was hoping to remove this mess - but it appears the dat indexes are being used? Or am I missing something?
October 27, 2016 at 10:46 am
krypto69 (10/27/2016)
Hi,Previous DBA used DTA to create allot of indexes.
I though DTA indexes always skipped (not used) by queries?
But when I run this:
SELECT OBJECT_NAME(S.[OBJECT_ID]) AS [OBJECT NAME],
I.[NAME] AS [INDEX NAME],
USER_SEEKS,
USER_SCANS,
USER_LOOKUPS,
USER_UPDATES
FROM SYS.DM_DB_INDEX_USAGE_STATS AS S
INNER JOIN SYS.INDEXES AS I ON I.[OBJECT_ID] = S.[OBJECT_ID] AND I.INDEX_ID = S.INDEX_ID
WHERE OBJECTPROPERTY(S.[OBJECT_ID],'IsUserTable') = 1
AND S.database_id = DB_ID()
I see values for 'user_updates, scans, etc'
I was hoping to remove this mess - but it appears the dat indexes are being used? Or am I missing something?
You're not missing anything. DTA indexes aren't necessarily skipped and they're not necessarily bad.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 27, 2016 at 11:01 am
All indexes suggested by DTA are useful within the context of sample query that was supplied to DTA. The problem is that often times these index suggestions are for niche query that's not commonly used (like for a single use month end report) or for queries that are obsolete and no longer used by the application.
To determine if an index is worth the cost of maintenance, you'll want to compare total seeks + scans + lookups versus total updates. Also look at the datetime related columns to determine how recently the index has been read.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
October 27, 2016 at 11:18 am
I think you're confusing the indexes created using DTA, with the indexes created during the DTA analysis but usually removed after the process completes. These later indexes are hypothetical and are marked that way in a sys.indexes column.
The following should return an empty set.
SELECT OBJECT_NAME(S.[OBJECT_ID]) AS [OBJECT NAME],
I.[NAME] AS [INDEX NAME],
USER_SEEKS,
USER_SCANS,
USER_LOOKUPS,
USER_UPDATES
FROM SYS.DM_DB_INDEX_USAGE_STATS AS S
INNER JOIN SYS.INDEXES AS I ON I.[OBJECT_ID] = S.[OBJECT_ID] AND I.INDEX_ID = S.INDEX_ID
WHERE OBJECTPROPERTY(S.[OBJECT_ID],'IsUserTable') = 1
AND S.database_id = DB_ID()
AND I.is_hypothetical = 1
October 27, 2016 at 12:16 pm
Yes.
Thanks everyone most helpful.
October 27, 2016 at 4:59 pm
Definitely don't want to just drop them all!!
DTA is just HORRIBLY misused in my experience! I once spent almost 200 man hours cleaning up rampant DTA use by a client that when they scaled up their data size and concurrent use essentially made there system unusable. Once I was done average read workload speed was down about 5% but writes, tlog activity and concurrency and some other metrics were all one to two orders of magnitude better.
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply