Home All Groups Group Topic Archive Search About

Alter Index On Database Rebuild (SQL Server 2005)



Author
30 Nov 2008 6:17 PM
Joe K.
I have a SQL Server 2005 database that I am trying to rebuild the indexes.
I used the ALTER INDEX ON TABLE_NAME REBUILD on each table.

After completing this task I ran the DBCC SHOWCONTIG on each table.

I noticed the logical scan fragmentation is set between 25 - 80.

I thought ALTER INDEX ON TABLE_NAME REBUILD would change the logical scan
fragmentation from DBCC SHOWCONTIG.

Please help me with this issue.

Thanks,

Author
30 Nov 2008 6:43 PM
JXStern
Two questions, what version of SQL Server, and what filegroup is your
table built on - and what files is the filegroup built on?  OK, that's
three questions.

Thanks.

Josh


On Sun, 30 Nov 2008 10:17:00 -0800, Joe K. <Joe
K*@discussions.microsoft.com> wrote:

Show quoteHide quote
>
>I have a SQL Server 2005 database that I am trying to rebuild the indexes.
>I used the ALTER INDEX ON TABLE_NAME REBUILD on each table.
>
>After completing this task I ran the DBCC SHOWCONTIG on each table.
>
>I noticed the logical scan fragmentation is set between 25 - 80.
>
>I thought ALTER INDEX ON TABLE_NAME REBUILD would change the logical scan
>fragmentation from DBCC SHOWCONTIG.
>
>Please help me with this issue.
>
>Thanks,
Are all your drivers up to date? click for free checkup

Author
30 Nov 2008 7:17 PM
Jeffrey Williams
JXStern wrote:
Show quoteHide quote
> Two questions, what version of SQL Server, and what filegroup is your
> table built on - and what files is the filegroup built on?  OK, that's
> three questions.
>
> Thanks.
>
> Josh
>
>
> On Sun, 30 Nov 2008 10:17:00 -0800, Joe K. <Joe
> K*@discussions.microsoft.com> wrote:
>
>> I have a SQL Server 2005 database that I am trying to rebuild the indexes.
>> I used the ALTER INDEX ON TABLE_NAME REBUILD on each table.
>>
>> After completing this task I ran the DBCC SHOWCONTIG on each table.
>>
>> I noticed the logical scan fragmentation is set between 25 - 80.
>>
>> I thought ALTER INDEX ON TABLE_NAME REBUILD would change the logical scan
>> fragmentation from DBCC SHOWCONTIG.
>>
>> Please help me with this issue.
>>
>> Thanks,
>

One more question :)

How large are the tables (number of rows/number of pages).  If the
tables have less than 100 pages - you probably will see a lot of those
tables still fragmented.

Oops - one additional question:

How much free space do you have in the data file?

Jeff
Author
1 Dec 2008 7:48 AM
Tibor Karaszi
> How large are the tables (number of rows/number of pages).

I agree, This is perhaps the most common reason ion these group where
a rebuild doesn't change things (much) - too few pages to be relevant.
The other would be that the index isn't really an index but a heap.
Posting the actual result will clarify these things.

Show quoteHide quote
"Jeffrey Williams" <jeff.williams3***@verizon.ent> wrote in message
news:Os0BWByUJHA.5856@TK2MSFTNGP03.phx.gbl...
> JXStern wrote:
>> Two questions, what version of SQL Server, and what filegroup is
>> your
>> table built on - and what files is the filegroup built on?  OK,
>> that's
>> three questions.
>>
>> Thanks.
>>
>> Josh
>>
>>
>> On Sun, 30 Nov 2008 10:17:00 -0800, Joe K. <Joe
>> K*@discussions.microsoft.com> wrote:
>>
>>> I have a SQL Server 2005 database that I am trying to rebuild the
>>> indexes.
>>> I used the ALTER INDEX ON TABLE_NAME REBUILD on each table.
>>>
>>> After completing this task I ran the DBCC SHOWCONTIG on each
>>> table.
>>>
>>> I noticed the logical scan fragmentation is set between 25 - 80.
>>>
>>> I thought ALTER INDEX ON TABLE_NAME REBUILD would change the
>>> logical scan fragmentation from DBCC SHOWCONTIG.
>>>
>>> Please help me with this issue.
>>>
>>> Thanks,
>>
>
> One more question :)
>
> How large are the tables (number of rows/number of pages).  If the
> tables have less than 100 pages - you probably will see a lot of
> those tables still fragmented.
>
> Oops - one additional question:
>
> How much free space do you have in the data file?
>
> Jeff
Author
30 Nov 2008 10:56 PM
Joe K.
The version is version 9 (3042 - SQL Server 2005), with Primary filegroup
with a single data file.

Thanks,

Show quoteHide quote
"JXStern" wrote:

> Two questions, what version of SQL Server, and what filegroup is your
> table built on - and what files is the filegroup built on?  OK, that's
> three questions.
>
> Thanks.
>
> Josh
>
>
> On Sun, 30 Nov 2008 10:17:00 -0800, Joe K. <Joe
> K*@discussions.microsoft.com> wrote:
>
> >
> >I have a SQL Server 2005 database that I am trying to rebuild the indexes.
> >I used the ALTER INDEX ON TABLE_NAME REBUILD on each table.
> >
> >After completing this task I ran the DBCC SHOWCONTIG on each table.
> >
> >I noticed the logical scan fragmentation is set between 25 - 80.
> >
> >I thought ALTER INDEX ON TABLE_NAME REBUILD would change the logical scan
> >fragmentation from DBCC SHOWCONTIG.
> >
> >Please help me with this issue.
> >
> >Thanks,
>
>
Author
1 Dec 2008 3:49 AM
jrstern
OK, then my latest "ghost" bugs are probably (!?) not involved.

For an easier way to look at fragmentation, try
http://msdn.microsoft.com/en-us/library/ms188917.aspx
sys.dm_db_index_physical_stats

I have noticed that rebuild sometimes does not do as
good a job as reorganize - pluls reorganize chases "ghosts" and
rebuild does not.

But neither gets you to zero fragmentation.  I guess I don't really
understand the process or limits, but have been doing some research
recently!

I presume you do have a clustered index on most/all of these tables,
and that that is one (only?) index that you rebuild/reorganize on.

Josh

Show quoteHide quote
"Joe K." <Joe K*@discussions.microsoft.com> wrote in message
news:93D50834-B2AC-4E0B-A717-28FF3A69842D@microsoft.com...
>
>
> The version is version 9 (3042 - SQL Server 2005), with Primary filegroup
> with a single data file.
>
> Thanks,
>
> "JXStern" wrote:
>
>> Two questions, what version of SQL Server, and what filegroup is your
>> table built on - and what files is the filegroup built on?  OK, that's
>> three questions.
>>
>> Thanks.
>>
>> Josh
>>
>>
>> On Sun, 30 Nov 2008 10:17:00 -0800, Joe K. <Joe
>> K*@discussions.microsoft.com> wrote:
>>
>> >
>> >I have a SQL Server 2005 database that I am trying to rebuild the
>> >indexes.
>> >I used the ALTER INDEX ON TABLE_NAME REBUILD on each table.
>> >
>> >After completing this task I ran the DBCC SHOWCONTIG on each table.
>> >
>> >I noticed the logical scan fragmentation is set between 25 - 80.
>> >
>> >I thought ALTER INDEX ON TABLE_NAME REBUILD would change the logical
>> >scan
>> >fragmentation from DBCC SHOWCONTIG.
>> >
>> >Please help me with this issue.
>> >
>> >Thanks,
>>
>>

Bookmark and Share