Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

Creating an Index Strategy

$
0
0
I'm currently in the process of looking to implement a index strategy for the first time and as I've never done this before I would just like to share some questions and hopefully understand if this is the right way or if there is a better process.I've been using MSDN, TechNet & also some online guides to get me in the right direction. The % that being passed around as a guide are below: 1. If frag > 5% and < = 30% then ALTER INDEX REORGANIZE2. If frag > 30% then ALTER INDEX REBUILD WITH (ONLINE = ON) Based on the piece of SQL code below say it returns 1000 indexes in the criteria:[code="sql"]SELECT OBJECT_NAME(ind.OBJECT_ID) AS TableName, ind.name AS IndexName, indexstats.index_type_desc AS IndexType, indexstats.avg_fragmentation_in_percentFROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats INNER JOIN sys.indexes ind ON ind.object_id = indexstats.object_id AND ind.index_id = indexstats.index_idWHERE indexstats.avg_fragmentation_in_percent >10-- using 10as an example....ORDER BY indexstats.avg_fragmentation_in_percent DESC[/code]1. If all are above 10%, does this mean I should "Reorganize" or potentially "Rebuild (if I decided to)" all 1000 or is it overkill? 2. Should I only do a small subset of say 100 indexes a night and let my job run once a day for 10 days in case it causes performance issues? should this process be avoided during office hours?3. Should I only target the ones that are most frequently used? if so how do I know that these are definitely the ones. What is it that I'm looking for as a reason? reads/writes/fill factor? sorry for the questions, just want to target this correctly first time around and understand the process going forward so I know best practice.

Viewing all articles
Browse latest Browse all 6525

Trending Articles