Files
DBAdmin/inbox/SQL-Server/index/idx_fradmentation.sql
T
2026-05-18 06:40:19 +00:00

6 lines
303 B
SQL

SELECT a.index_id, name, avg_fragmentation_in_percent, fragment_count,
avg_fragment_size_in_pages
FROM sys.dm_db_index_physical_stats (DB_ID('AdventureWorks2017'),
OBJECT_ID('Sales.SalesOrderDetail'), NULL, NULL, NULL) AS a
JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id