mssql view index fragmentation and rebuild index

SELECT index_type_desc,alloc_unit_type_desc,avg_fragmentation_in_percent,fragment_count,avg_fragment_size_in_pages,
page_count,record_count,avg_page_space_used_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID('database'),OBJECT_ID('table name'),NULL,NULL,'Sampled');

  Please respect knowledge and originality. For more information, please refer to http://www.cezuwang.com/listFilm?page=1&areaId=906&filmTypeId=1 When the field avg_fragmentation_in_percent is greater than 40%, you must consider the necessity of sorting and rebuilding the index sex  



ALTER INDEX KID ON BaseCustomer REBUILD

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326922575&siteId=291194637