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

Index fragmentation and index page usage

$
0
0

In the post

http://social.technet.microsoft.com/Forums/en-US/149142c3-0f49-4e7d-9281-dc1767b3e87e/sptvalues-3rd-party-sql-monitor-and-index-fragmentation

it was suggested that index fragmentation on user tables should be ignored unless the index required more than 1000 pages. I am trying to setup a query to test for this condition.  Is this correct?

select

           DB_NAME(Ips.database_id) as DBName ,
          'Index Name' as IndexName

from sys.dm_db_index_physical_stats(Ips.database_id, NULL, NULL, NULL , 'DETAILED') as Ips
join sys.indexes as SysI
on (Ips.index_id = SysI.index_id)
where Ips.avg_fragmentation_in_percent > 60  ' my magic number
and (Ips.fragment_count * Ips.avg_fragment_size_in_pages > 1000)

 

TIA,

edm2


Viewing all articles
Browse latest Browse all 15889

Trending Articles



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