How can you find Index Fragmentation in a SQL Server Database?

Through Below query you are able to find out index fragmentation in SQL Server databases:-

 

select avg_fragmentation_in_percent,OBJECT_Name(object_id),

* from sys.dm_db_index_physical_stats(DB_ID(),null,null,null,’limited’) A

where page_count>1000

and

avg_fragmentation_in_percent>10

order by A.avg_fragmentation_in_percent desc

 

Leave a Reply

Your email address will not be published. Required fields are marked *