1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
/* index id */
select INDEXPROPERTY ( object_ID(maTable) , '$17' , 'IndexId')
/* return 128 */
/* fragmentation index */
select avg_fragmentation_in_percent, page_count
FROM sys.dm_db_index_physical_stats(DB_ID('maBD'), OBJECT_ID(maTable), NULL, NULL, NULL)
WHERE index_id = 128
/* return ! après 1 min 30 ! */
avg_fragmentation_in_percent page_count
29,9687010954617 3834
/* check integrite table */
DBCC CHECKTABLE ( maTable, 128 )
WITH ALL_ERRORMSGS
/* pas de message d'erreur */
/* stat utilisation index */
SELECT *
FROM sys.dm_db_index_usage_stats
WHERE object_id = OBJECT_ID(maTable)
and index_id = 128
/* return : last user_seek : 2012-07-05 18:50:24.237 */
database_id object_id index_id user_seeks user_scans user_lookups user_updates last_user_seek last_user_scan last_user_lookup last_user_update system_seeks system_scans system_lookups system_updates last_system_seek last_system_scan last_system_lookup last_system_update
11 1177276195 128 1631 12 0 33521 2012-07-05 18:50:24.237 2012-07-06 10:15:01.853 NULL 2012-07-06 16:30:52.853 0 2 0 0 NULL 2012-07-05 08:43:11.210 NULL NULL |
Partager