Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
jbrotto
Active Contributor
0 Kudos

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

SELECT
i.name 'index',
s.name 'schema',
t.name 'table',
p.avg_fragmentation_in_percent,
p.index_type_desc,
p.record_count


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

http://www.youtube.com/watch?v=B3_LQetPxjI

Credit to them and Maxim Michtchenko.

Labels in this area