﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Joey Doherty / Article Discussions / Article Discussions by Author  / Indexes and Fragmentation in SQL Server 2000 Part 1 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 05:37:35 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Hey Cort Ellingson - email me !!!  Victor Champney  vwchampney@aol.com</description><pubDate>Mon, 12 Nov 2007 20:31:48 GMT</pubDate><dc:creator>dataguy2202</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Good Article, looking forward to have next..</description><pubDate>Thu, 29 Mar 2007 03:29:00 GMT</pubDate><dc:creator>binu john</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Thanks to both Joe and Billy. We are currently trying to optimize a fairly large production DB, and adding clustered indexes is part of the plan. The database gets steady inserts, updates from 50 workstations that hit primarily 13 tables. We plan to re-create everything from scratch and allocate enough space this time around to accommodate 5 years data input without the DB needing to grow. Fortunately we have lots of disk space to work with. We will then read the data back in from the archived database. We run a nightly maintenance job that rebuilds indexes leaving 20% free space. We have stopped the part of the job that shrinks the database, as we were noticing that there was 0 free space showing in EM. With heavy inserts and updates everyday, 0 free space doesn't seem appropriate.We also were informed that the Sys Admin at the customer site had not been running ANY type of disk defragmentation in the last 2 years. The RAID 1 drive where our log file resides showed 46% overall fragmentation. The RAID 5 data drive showed 30% fragmentation. Yes I know that RAID 10 is better, but the server can't take any more drives.</description><pubDate>Wed, 20 Dec 2006 09:26:00 GMT</pubDate><dc:creator>John Kotuby</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Joe,I like the way you present this topic step by step. Thanks. I really learnt much from this article. It is really helpful.Girish</description><pubDate>Wed, 20 Dec 2006 05:53:00 GMT</pubDate><dc:creator>Girish Rathi</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt; &lt;/P&gt;&lt;P&gt;Joe,&lt;/P&gt;&lt;P&gt;Thanks alot for nice article. Would like to go for next part of this with not much gap. Hope you will post it very soon. By the way, I have question here...how data stores if we define a clustured index on a column which contains duplicate data and how it results when we SELECT it..please clarify.&lt;/P&gt;&lt;P&gt;Onceagain thanks for spending time for this good work.&lt;/P&gt;&lt;P&gt;-LRP&lt;/P&gt;</description><pubDate>Thu, 26 Oct 2006 01:10:00 GMT</pubDate><dc:creator>Laxma Reddy P</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;You are right to point that out. Perhaps I should have made it clear that we were dealing with data that had &lt;STRONG&gt;NO&lt;/STRONG&gt; indexes applied (clustered and non-clustered).&lt;/P&gt;&lt;P&gt;With part 1 of the series I simply wanted to get people thinking in terms of a heap of data stored in data pages. And to also introduce a few basics we could build on.As you will see in the following parts we will introduce clustered and non-clustered indexes.&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;</description><pubDate>Wed, 25 Oct 2006 06:44:00 GMT</pubDate><dc:creator>Joe Doherty-260822</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;Thanks for an enlightening article, Joe.&lt;/P&gt;&lt;P&gt;You state: "Running any form of query on a heap will force a full scan of the table and could take a considerable amount of time. And the results from the DBCC SHOWCONTIG command, which is a tool for measuring fragmentation, is also of little use on a heap. "&lt;/P&gt;&lt;P&gt;I want to make sure I understand correctly. If TableA has a non-clustered index on ColumnA, but no clustered indexes..... and I select * from TableA Where ColumnA = 'abc'......... a table scan will be performed?  I didn't know that. I thought by having an index on the column I'm querying on, that was sufficient to prevent a table scan (unless the table only has a few rows of course).  Please elaborate.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Thanks, John&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Wed, 25 Oct 2006 06:30:00 GMT</pubDate><dc:creator>dbaforever</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;It was a great article!!! I am waiting for the next article as this gives ignition to all thoughts regarding Fragmentation. &lt;/P&gt;</description><pubDate>Wed, 25 Oct 2006 00:31:00 GMT</pubDate><dc:creator>Reecha Mishra</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Thank you *very much* for a really interesting and useful article and I'll be watching closely for more installments.  &lt;img src='images/emotions/biggrin.gif' height='20' width='20' border='0' title='Big Grin' align='absmiddle'&gt;</description><pubDate>Tue, 24 Oct 2006 15:41:00 GMT</pubDate><dc:creator>Steve Calverley</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Looking forward to someone being able to explain why extent scan fragmentation shows in the high eighties or ninties AFTER turning OFF sql server services...  No change whatsoever...</description><pubDate>Tue, 24 Oct 2006 14:47:00 GMT</pubDate><dc:creator>B Hilderman</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;Thanks for the article, very nice, and I look foward to the continuation on this subject.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ThomBeaux&lt;/P&gt;</description><pubDate>Tue, 24 Oct 2006 09:26:00 GMT</pubDate><dc:creator>Thomas LeBlanc</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;In the days before good databases were avaialable for PC's I was having to retrive data from random files in an ordered manner.  We used bianry files to store the data and then built an index for the ordering (MySQL anyone?).  We used a tree.  Not exactly a B-tree.&lt;/P&gt;&lt;P&gt;First, we did not give a rip about balancing.  The ordering of blocks within the index file was of almost no concern.  Even at 233 clock speeds we were able to fetch the first record in an order in way under a second.&lt;/P&gt;&lt;P&gt;Performance suffered when we had to add all of the overhead of making it multi-user capable.  This was in the days when the only networking that we had was shared file access. &lt;img src='images/emotions/w00t.gif' height='20' width='20' border='0' title='w00t' align='absmiddle'&gt;&lt;/P&gt;</description><pubDate>Tue, 24 Oct 2006 08:18:00 GMT</pubDate><dc:creator>Charles Kincaid</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Nice article.  Been doing lots of digging around with data pages/indexes/heaps of late as it's a hot topic where I work.  Looking forward to seeing the next article.</description><pubDate>Tue, 24 Oct 2006 03:24:00 GMT</pubDate><dc:creator>Clive Strong</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;You're not totally correct concerning a HEAP, some rdbms allow the table and index structures to be defined ( not all B Tree's by default )  heaps do not always fragment. &lt;STRONG&gt;IF&lt;/STRONG&gt; the table is not subject to updates which cause deferred updates and there are no deletes then your heap will not fragment, all new data arrives on the top of the heap - hence the term. Secondary indexes on a heap can be defragmented without issue. Technically if your heap is a fifo ( first in first out ) then even the deletes would not fragment the table structure. &lt;/P&gt;&lt;P&gt;I agree that it's best practice to have a clustered index, and in fact most tables I see are still heaps , but with a clustered index. Also agreed that the leaf or data fragmentation in a table cannot be removed without a clustered index, however not all heaps fragment.&lt;/P&gt;</description><pubDate>Tue, 24 Oct 2006 03:09:00 GMT</pubDate><dc:creator>colin.Leversuch-Roberts</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;Mike,&lt;/P&gt;&lt;P&gt;I'll make sure information on all data types is included within this series. Thanks for your input.&lt;/P&gt;&lt;P&gt;Thanks to everyone who has contributed and shown an interest.&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;</description><pubDate>Mon, 23 Oct 2006 14:06:00 GMT</pubDate><dc:creator>Joe Doherty-260822</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Billy, I agree with you.  This goes into our mystery.  One table with less than 100 thousand rows had sporadic inserts take &lt;STRONG&gt;&lt;EM&gt;&lt;U&gt;MINUTES&lt;/U&gt;&lt;/EM&gt;&lt;/STRONG&gt; 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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;What the ...?&lt;img src='images/emotions/blink.gif' height='20' width='20' border='0' title='Blink' align='absmiddle'&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Mon, 23 Oct 2006 10:00:00 GMT</pubDate><dc:creator>Charles Kincaid</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;Hi Billy&lt;/P&gt;&lt;P&gt;Great additional help to Joe's article.&lt;/P&gt;&lt;P&gt;Thanks for this.&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;</description><pubDate>Mon, 23 Oct 2006 09:19:00 GMT</pubDate><dc:creator>PaulSp</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;How this relates to the real world is this...&lt;img src='images/emotions/doze.gif' height='20' width='20' border='0' title='Doze' align='absmiddle'&gt;&lt;/P&gt;&lt;P&gt;1) No clustered Index = A Heap&lt;/P&gt;&lt;P&gt;2) Add some Non-clustered indexes to a table and you still have a heap&lt;/P&gt;&lt;P&gt;3) Add more data with the non-clustered indexes and your heaped table will GROW by leaps and bounds !!&lt;/P&gt;&lt;P&gt;4) You want to make the table smaller BUT &lt;img src='images/emotions/cry.gif' height='20' width='20' border='0' title='Cry' align='absmiddle'&gt; a heap cannot be defragged! (nothing works, DBCC indexdefrag etc..)&lt;/P&gt;&lt;P&gt;5) You MUST create a clustered index to force defragmentation&lt;/P&gt;&lt;P&gt;Moral - NEVER create non-clustered indexes without creating a clustered index first!&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;- B&lt;/P&gt;</description><pubDate>Mon, 23 Oct 2006 07:28:00 GMT</pubDate><dc:creator>Billy Eastwood</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Good article, To the point. Cleared the basics! Keep up the good work.</description><pubDate>Mon, 23 Oct 2006 06:58:00 GMT</pubDate><dc:creator>Ravi Prashanth Lobo-275382</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Very nice - I have learned a lot, cannot wait till the next article.</description><pubDate>Mon, 23 Oct 2006 06:45:00 GMT</pubDate><dc:creator>Cory E.</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>&lt;P&gt;Hi Joe&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Many thanks for the time you spent on this.&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;</description><pubDate>Mon, 23 Oct 2006 04:16:00 GMT</pubDate><dc:creator>PaulSp</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>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.</description><pubDate>Mon, 23 Oct 2006 03:27:00 GMT</pubDate><dc:creator>MikeTomkies</dc:creator></item><item><title>RE: Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>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.aspand 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 BillerKoby@disklace.com</description><pubDate>Mon, 23 Oct 2006 02:23:00 GMT</pubDate><dc:creator>Koby BILLER</dc:creator></item><item><title>Indexes and Fragmentation in SQL Server 2000 Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic315657-322-1.aspx</link><description>Comments posted here are about the content posted at &lt;A HREF="temp"&gt;temp&lt;/A&gt;</description><pubDate>Mon, 16 Oct 2006 09:35:00 GMT</pubDate><dc:creator>Joe Doherty-260822</dc:creator></item></channel></rss>