Oh my goodness, I have been buried and learning tons about Indexing. Something super cool that I learned was how to know if you need to adjust your fillfactors on your indexes. My whole DBA career I have usually set it 85 and forgotten it. I learned that I can check my CommandLog and see how often that index is being rebuilt. I am currently using Ola and when my indexes are rebuilt for maintenance (rebuilt nightly in this case), it is all logged to a table named CommandLog in the master database. If an index is rebuilt everyday, adjust the fillfactor down (75) so that it will rebuild less often. If it nearly never rebuilds, adjust the fillfactor up (90) so it gets rebuilt once in a while and to avoid wasting space in an index. Here is the query I am using to see how often an index has rebuilt in the last 10 days.
SELECT Command, COUNT(StartTime) AS Rebuilt FROM master.[dbo].[CommandLog] WHERE CommandType LIKE '%Index%' AND StartTime > GETDATE()-10 GROUP BY Command ORDER BY Rebuilt DESC
When I see ones that have a rebuilt number of 10, 9 or 8, I know those are rebuilding nearly everyday. I will adjust their fillfactors down so that I don’t rebuild as often. My sweet spot right now is once a week, but that doesn’t work for every index (or environment). This is where the art part comes into the DBA world and I have to think about what is best for the system. If I have already adjusted something down to 75 and it is still rebuilding frequently, I will adjust that number down more (65, then 55), and back up if it is too low. I also evaluate how much that index is used and how important it is to keep healthy. If it is hardly ever used, do I want to waste fillfactor space?
Indexing is absolutely an art, but now I have a new brush for my kit by being able to query the CommandLog.
This post’s song is Particles by Nothing But Thieves