SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sys.dm_db_index_physical_stats - Doubt in the Results


sys.dm_db_index_physical_stats - Doubt in the Results

Author
Message
balasach82
balasach82
SSC Eights!
SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)

Group: General Forum Members
Points: 879 Visits: 1084
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?
GilaMonster
GilaMonster
SSC Guru
SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)

Group: General Forum Members
Points: 91961 Visits: 45285
One for each level of the index.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


Sean Pearce
Sean Pearce
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1848 Visits: 3432
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
balasach82
balasach82
SSC Eights!
SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)

Group: General Forum Members
Points: 879 Visits: 1084
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%
GilaMonster
GilaMonster
SSC Guru
SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)

Group: General Forum Members
Points: 91961 Visits: 45285
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, MVP, M.Sc (Comp Sci)
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


balasach82
balasach82
SSC Eights!
SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)

Group: General Forum Members
Points: 879 Visits: 1084
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)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)

Group: General Forum Members
Points: 91961 Visits: 45285
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, MVP, M.Sc (Comp Sci)
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


balasach82
balasach82
SSC Eights!
SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)

Group: General Forum Members
Points: 879 Visits: 1084
Yes, starting from 1 to 230 is the page count for such NC which has more % frag
GilaMonster
GilaMonster
SSC Guru
SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)

Group: General Forum Members
Points: 91961 Visits: 45285
Too small to bother with.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


balasach82
balasach82
SSC Eights!
SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)SSC Eights! (879 reputation)

Group: General Forum Members
Points: 879 Visits: 1084
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search