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
 General SQL Server Forums
 New to SQL Server Programming
 DB Maintenance -dbreindex

Author  Topic 

tobyc
Starting Member

3 Posts

Posted - 2007-04-19 : 09:18:33
We are running a maintenance plan that rebuilds the indexes for all the databases. I have ran showcontig after the maintenance plan and am still seeing fragmentation. Here is one of the master tables that is included in on the maintenance job.
sysobjects table:
pages scanned - 5
extents scanned - 3
extents switches - 3
avg. pages per extent - 1.7
scan density - 25%
logical scan fragmentation - 40%
extent fragmentation - 66.67%
avg.bytes free per page - 1360.4
avg. page density 83.19%
According to what I have read this still seems to be fragmented. What can be done to improve this?

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-04-19 : 09:34:15
Maintenance plan doesn't handle system tables. Also, sql puts small tables in shared extents. You can't get them to 100% scan density.
Go to Top of Page

tobyc
Starting Member

3 Posts

Posted - 2007-04-19 : 09:40:48
Should the system tables be reindexed? If so would a seperate job that runs dbreindex on the master work to defrag the system tables?

Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-04-19 : 09:57:22
Don't have to, and dbreindex doesn't work on sysytem tables.
Go to Top of Page

tobyc
Starting Member

3 Posts

Posted - 2007-04-19 : 10:57:49
Okay, I'll quit worring about the system tables.
The next question is related.
Last night I ran the maintenance plan (options: reorganize data and index pages - change free space per page percentage to 10%). IT still seems to be fragmented this morning.
pages scanned - 72
extents scanned -18
extent switches -17
avg. pages per extent - 4
Scan Density - 50%
Extent scan fragmentation - 94%
avg. butes free per page 5124
avg. page density 36.68%
From what I have read so far, the scan density should be as close to 100% as possible. The extent canc fragmentation should be between 0% and 10%. This table still seems fragmented.
IN this case I'm not sure what to do. The maintenance plan uses dbreindex, but does it work differently if you use the maintenance plan or run the command in a job by itself? Any explaination of this would be appreciated. Thanks,
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-04-19 : 16:54:21
If the table doesn't have clustered index, you can't defrag it. By the way, did you check index fill factor? Too much free space on the page.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-20 : 02:25:38
Apart from the System Table issue I don't think its worth worrying about for small tables.

We Defrag big tables, and Reindex small tables

Kristen
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2007-04-20 : 04:08:45
Kristen in this context what would you define as big?

steve

-----------

Don't worry head. The computer will do all the thinking from now on.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-20 : 09:00:51
"in this context what would you define as big?"

HiYa!

CountPages from DBCC SHOWCONTIG >= 10000

Kristen
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2007-04-24 : 03:39:08
Thanks, is this based on any figures or is it a gut feeling sort of thing based on experience?

cheers

steve

-----------

Don't worry head. The computer will do all the thinking from now on.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-24 : 04:05:08
Well its the figure we use, can't remember how we came to it!

We did find that using IndexDefrag (SQL 2000) was still leaving SHOWCONTIG with poor density results, and we also thought that for small tables REINDEX would not block them for long. However, I was surprised to see a Page Count as high as 10,000 when I went to check for you - so it may be a bit high!

Kristen
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2007-04-25 : 03:01:04
Fair enough, Many thanks Kristen

steve

-----------

Don't worry head. The computer will do all the thinking from now on.
Go to Top of Page
   

- Advertisement -