Howto: check database fragmentation sql server

Howto: check database fragmentation sql server

How to find all indexes that have fragmentation over 25%:

select * FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL , NULL, 'LIMITED') 
WHERE avg_fragmentation_in_percent > 25.0
 AND index_id > 0
 AND page_count > 1000 
order by avg_fragmentation_in_percent desc

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>