Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Logical Scan Fragmentation

Author  Topic 

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-08-16 : 13:08:00
I have a table with 50% Logical Scan Fragmentation. [ according to Dbcc Showcontig (myTable) ]
Why after running DBCC INDEXDEFRAG (myDB,myTable) does it still sit at 50%.
Why isn't it lower?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-16 : 14:43:51
use alter index
and see what the results are then.


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-16 : 22:48:51
Need rebuild clustered index.
Go to Top of Page

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-08-17 : 06:36:50
thought it was that. I guess I've hoped all this time that defragging can do a bit better of a job than that...

ALTER INDEX ALL ON myTable
REBUILD WITH (FILLFACTOR = 100)
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2007-08-17 : 07:34:57
FILLFACTOR = 100....now you are inviting more fragmentation straight away afterwards....would you not have gone for for 95,96,97?...i.e. to leave some minor expansion room before the 1st hit for new space on the 1st insert of a new record.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-17 : 07:38:35
that depends opn his PK type.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-08-17 : 11:10:07
in this particular case 100 is the correct value because data in this table changes once a year.
i choose fillfactors on a table by table basis and always pad them

my pk is a single column guid non-clustered
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-17 : 11:13:06
my bad. depends on you Clustered Index datatype not PK.

i always somehow assume that the PK is the clustered index.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -