Sitecore server performance depends a lot on underlying SQL server performance. If SQL server performance decreases, Sitecore server performance will decrease too. That's why its important to have SQL server maintenance plans.
Maintenance plans create a workflow of the tasks required to make sure that your database is optimized, regularly backed up, and free of inconsistencies. You can learn more about maintenance plans here.
We observed that a poor maintenance plan can lead to SQL timeout errors in application and the high fragmentation level in the SQL indexes can have major role to play in it.
Sitecore recommends keeping index fragmentation below 10%
If you see error in your logs which read something like below, its time for you to check your index fragmentation levels and revisit your SQL server maintenance plans -
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
How to know if index fragmentation is too high?
Below is a SQL query that Sitecore support team shared with us to know the level of index fragmentation in our databases -
SELECT dbschemas.[name] as 'Schema',
dbtables.[name] as 'Table',
dbindexes.[name] as 'Index',
indexstats.avg_fragmentation_in_percent,
indexstats.page_count
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS indexstats
INNER JOIN sys.tables dbtables on dbtables.[object_id] = indexstats.[object_id]
INNER JOIN sys.schemas dbschemas on dbtables.[schema_id] = dbschemas.[schema_id]
INNER JOIN sys.indexes AS dbindexes ON dbindexes.[object_id] = indexstats.[object_id]
AND indexstats.index_id = dbindexes.index_id
WHERE indexstats.database_id = DB_ID()
ORDER BY indexstats.avg_fragmentation_in_percent desc
ALTER INDEX Index_Name ON Table_Name REBUILD
Comments
Post a Comment