Skip to Content

Sometimes the biggest bottleneck in the SAP business One setup is SQL server. Here is a query to check for fragmentation.

SELECT ‘index’, ‘schema’, ‘table’,

FROM sys.dm_db_index_physical_stats ( DB_ID(), NULL, NULL, NULL, ‘DETAILED’) as p
JOIN sys.indexes as i on p.object_id = i.object_id and p.index_id = i.index_id
JOIN sys.tables as t on t.object_id = p.object_id
JOIN sys.schemas as s on s.schema_id = t.schema_id
WHERE p.index_id > 0
ORDER BY p.avg_fragmentation_in_percent DESC

Got this query from the vission33 channel on YouTube

Credit to them and Maxim Michtchenko.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply