Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

sys.dm_db_index_physical_stats - Doubt in the Results Expand / Collapse
Author
Message
Posted Wednesday, July 17, 2013 2:45 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, August 22, 2014 8:54 AM
Points: 393, Visits: 973
For a table with 3 indexes, 1 clustered and 2 NC, Index Physical status dmv returned 53 rows with clustered index repeated 4 times with varying % fragmentation, similarly for other 2 indexes too.

why multipls rows for one index?
Post #1474804
Posted Wednesday, July 17, 2013 3:33 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:07 PM
Points: 42,812, Visits: 35,931
One for each level of the index.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1474820
Posted Thursday, July 18, 2013 2:43 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 8:22 AM
Points: 874, Visits: 2,793
http://msdn.microsoft.com/en-us/library/ms188917.aspx

Returns size and fragmentation information for the data and indexes of the specified table or view. For an index, one row is returned for each level of the B-tree in each partition. For a heap, one row is returned for the IN_ROW_DATA allocation unit of each partition. For large object (LOB) data, one row is returned for the LOB_DATA allocation unit of each partition. If row-overflow data exists in the table, one row is returned for the ROW_OVERFLOW_DATA allocation unit in each partition.




The SQL Guy @ blogspot

@SeanPearceSQL

About Me
Post #1474940
Posted Thursday, July 18, 2013 7:48 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, August 22, 2014 8:54 AM
Points: 393, Visits: 973
I ran indexphysical stats dmv and found 4 rows for 1 clustered index with depth 4 row having 80% fragmentation. Even after runnning, ALTER INDEX [INDEX] ON [dbo].[TABLE] REBUILD WITH (FILLFACTOR=90, online=on). Fragmentation remains at 100%.

1. How to reduce this fragmentation in Clustered index at depth 4(in general for all depth rows)
2. How to reduce frag for NC which too are at 100%
Post #1475046
Posted Thursday, July 18, 2013 7:59 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:07 PM
Points: 42,812, Visits: 35,931
balasach82 (7/18/2013)
1. How to reduce this fragmentation in Clustered index at depth 4(in general for all depth rows)


Don't bother trying. The highest level is the root, which is only a single page.

2. How to reduce frag for NC which too are at 100%


Same way you do for a clustered index. Alter index ... rebuild or Alter index .. reorganize



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1475050
Posted Thursday, July 18, 2013 8:10 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, August 22, 2014 8:54 AM
Points: 393, Visits: 973
1. The other 3 Depth rows (other than 1) has more frag >70. Rebuild reduced frag for depth id 1 row
2. NC - I ran both rebuild and reorganize for couple of NC. There was no change in frag levels

My select which accesses these tables runs very slow in one server, but runs very quickly in another server with less config setup (less cpu, ram etc)
Post #1475053
Posted Thursday, July 18, 2013 8:14 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:07 PM
Points: 42,812, Visits: 35,931
Ignore the non-leaf levels unless they're absolutely huge.
Let me guess, those nonclustered indexes are tiny, just a couple of pages?



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1475055
Posted Thursday, July 18, 2013 8:38 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, August 22, 2014 8:54 AM
Points: 393, Visits: 973
Yes, starting from 1 to 230 is the page count for such NC which has more % frag
Post #1475062
Posted Thursday, July 18, 2013 9:36 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:07 PM
Points: 42,812, Visits: 35,931
Too small to bother with.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1475100
Posted Thursday, July 18, 2013 9:37 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, August 22, 2014 8:54 AM
Points: 393, Visits: 973
Gail, what else can be done to improve query running time. Since query runs in <1min in another dev server but runs for 2hrs in production machine
Post #1475101
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse