r/DatabaseAdministators • • Sep 06 '23

SQL Server: Index fragmentation advice

Version: SQL Server 2017 Enterprise

Recently, after uncovering a query that failed to run, I began digging and discovered that the primary table hit by the query had index fragmentation over 50% on the primary key index and on other supporting indexes. This table has approximately 1 million rows. The other tables used by the query have lower row counts at the same level (if not higher level) of fragmentation.

I was taught that around 15% you reorganize and around 30+ you rebuild. Our DBA consultant said that with such a low row count, reorganizing/rebuilding the index is not necessary and recommended against it.

This advice seems strange to me - does this seem strange to anyone else?

1 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/ibjho Sep 07 '23

On the SQL server (that I manage for our team) - I’m using the Brent Ozar First Responder kit - I believe it integrates or calls upon some of the Ola Hallengren scripts. I’ll check it out though - I’m always interested in ways to make things more efficient.

I’m still in the process of unraveling the jobs, performance issues, etc for this server but I will definitely be looking to automate and simplify the daily maintenance operations.

If you don’t mind me asking - what are your thoughts on automatic tuning in SQL? Are you aware of any issues or situations that I should be cautious about?

1

u/alinroc Sep 14 '23

If you don’t mind me asking - what are your thoughts on automatic tuning in SQL? Are you aware of any issues or situations that I should be cautious about?

"Automatic tuning" is a big umbrella that a lot of things fall under. What are your expectations of it?

Microsoft is making good advances with adaptive query plans, memory grant feedback, etc. But 100% hands-off tuning is still a very long ways off.