Friday 8 January 2010

Pagelinkage APL - Another way to check for fragmentation

SELECT name, first FROM sysindexes WHERE indid not in (0,1) AND id = object_id('PREVPOS')
Non clustered index.


The above gives you the frst page of the leaf level of the nci. Basically our aim is to see how much fragmentation is there in the index leaf level pages

dbcc pglinkage(4,808536,0,2,0,1)
We can view haphazard page chain which increases disk seek times, fragmentation
NCI highly fragmented


This will show you the links from one page to another, and you can observe if their are multiple jumps in between pages in different extets or the pages are organised in a sequential increasing manner.
A new index will have sequential pages, but as there will be more inserts, deletes on index keys, the index gets fragmented.

No comments:

Post a Comment