Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Fregmentation Level of Index

$
0
0

Hi,

    we are using sql 2005 and will be migrating to sql 2008 r2 in couple of months.

    i am trying to use "sys.dm_db_index_physical_stats" dmv to get fragmentation level of an index but it's getting stuck after certain rows. any suggestions.

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT ps.database_id, ps.OBJECT_ID,
ps.index_id, b.name,
ps.avg_fragmentation_in_percent
--INTO #temp_Indexes
FROM sys.dm_db_index_physical_stats (7, NULL, NULL, NULL, 'LIMITED') AS ps  
INNER JOIN sys.indexes AS b (NOLOCK) ON ps.OBJECT_ID = b.OBJECT_ID
AND ps.index_id = b.index_id

NOw i am using DBCC SHOWCONTIG but this will be deprecated in near future.


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>