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


Indexes and Fragmentation in SQL Server 2000 Part 1


Indexes and Fragmentation in SQL Server 2000 Part 1

Author
Message
Joe Doherty-260822
Joe Doherty-260822
Old Hand
Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)

Group: General Forum Members
Points: 391 Visits: 180
Comments posted here are about the content posted at temp
Koby BILLER
Koby BILLER
SSC-Enthusiastic
SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)

Group: General Forum Members
Points: 123 Visits: 1
Joe,
Thank you for the excellant article.
When I wrote a year ago my article about fragmentation, this is exactly what I had in mind - but since I am not an SQL expert, I could not do it myself.
Please read my article at http://www.sqlservercentral.com/columnists/kbiller/performancemonitoringbyinternalfragmentationmeasur.asp
and look at www.disklace.com where I present the fragmentation measurement model. This model is working for more than 100,000 users, and proves to be accurate. If you want to join forces and give the audience of this forum a solution - I am ready.
Koby Biller
Koby@disklace.com
MikeTomkies
MikeTomkies
SSC Eights!
SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)

Group: General Forum Members
Points: 981 Visits: 83
Thanks for the article cant wait for the next instalment. One thing that has confused me over the years is how sql stores and organises text data. You do not include this type of data field in your table,is their a reason for this? if you can just explain about text data as i find you explinations so far very easy to understand.



PaulSp
PaulSp
SSC Eights!
SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)

Group: General Forum Members
Points: 981 Visits: 286

Hi Joe

I really enjoyed this article. I am not a SQL expert in any way, and found the step by easy step approach excellent. I really feel I have learned something and time spent here was very worthwhile. I look forward to the next article - particularly with a view towards indexes.

Many thanks for the time you spent on this.

Paul


Cory E.
Cory E.
Hall of Fame
Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)

Group: General Forum Members
Points: 3035 Visits: 10845
Very nice - I have learned a lot, cannot wait till the next article.

-- Cory
Ravi Prashanth Lobo-275382
Ravi Prashanth Lobo-275382
SSC Veteran
SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)

Group: General Forum Members
Points: 254 Visits: 1
Good article, To the point. Cleared the basics! Keep up the good work.
Billy Eastwood
Billy Eastwood
Old Hand
Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)

Group: General Forum Members
Points: 313 Visits: 5

How this relates to the real world is this...

1) No clustered Index = A Heap

2) Add some Non-clustered indexes to a table and you still have a heap

3) Add more data with the non-clustered indexes and your heaped table will GROW by leaps and bounds !!

4) You want to make the table smaller BUT a heap cannot be defragged! (nothing works, DBCC indexdefrag etc..)

5) You MUST create a clustered index to force defragmentation

Moral - NEVER create non-clustered indexes without creating a clustered index first!

I have come across this knowledge through evaluation of a legacy database which is massive for apparently no reason. I could not shrink its size no matter what I did. Only after much reading did I come across the "Heap Gem" of knowledge and was able to cut the DB down to 40% of its original size by adding, yes adding, clustered indexes to the top 30 largest tables. There were hundreds of tables, dunno what would have happened by adding a CI to all appropriate tables.

- B


PaulSp
PaulSp
SSC Eights!
SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)

Group: General Forum Members
Points: 981 Visits: 286

Hi Billy

Great additional help to Joe's article.

Thanks for this.

Paul


Charles Kincaid
Charles Kincaid
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4937 Visits: 2384

Great article Joe. Thanks a bunch. Your take on extent switching was new to me. I'm in hopes that the rest of your series will help clear up a mystery for us.

Billy, I agree with you. This goes into our mystery. One table with less than 100 thousand rows had sporadic inserts take MINUTES to complete. The majority of inserts take fractions of seconds. All DBCC indications were clean. Re-index had been done and still it happened. A specific insert would hang. If you drop the row and re-run that specific insert would take long.

In frustration I advised the guy working the problem to drop all the indexes and recreate them. Most are non-clustered and the clustered is PK on the identity column. Dropping the clustered index took 20 minutes. Re-creating the indexes seems to have fixed the problem.

What the ...?



ATBCharles Kincaid
Joe Doherty-260822
Joe Doherty-260822
Old Hand
Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)

Group: General Forum Members
Points: 391 Visits: 180

Mike,

I'll make sure information on all data types is included within this series. Thanks for your input.

Thanks to everyone who has contributed and shown an interest.

Joe


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