Advertisement
cbossie

SQL Server Index Fragementation

Mar 19th, 2020
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.36 KB | None | 0 0
  1. select
  2.     a.index_id,
  3.     OBJECT_NAME(b.object_id) as object,
  4.     name,
  5.     avg_fragmentation_in_percent as frag,
  6.     fragment_count,
  7.     avg_fragment_size_in_pages,
  8.     *
  9. from
  10.     sys.dm_db_index_physical_stats (DB_ID('Pricing'), null, NULL, NULL, NULL) as a
  11. INNER join
  12.     sys.indexes as b on
  13.     a.object_id = b.object_id and
  14.     a.index_id = b.index_id
  15. ORDER BY
  16.     frag DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement