Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reindexing


Reindexing

Author
Message
frank.pron
frank.pron
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 49
I ran a script to reindex all the tables in my database such as sp_MSforeachtable"DBCC DBREINDEX("?")WITH NO_INFOMSGS' and I noticed that tables with less than 1000 pages were not touched. I understand that most re-indexing scripts don't touch tables with less than 1000 pages or extents with less than 8, however, a very high number of these specific tables are fragmented at 100%. I also understand that Microsoft supposedly uses index scan on these tables this small as opposed to index seeks (not sure if I have this correct), so therefore we won't see any significant improvements in performance by re-indexing? Some say tables under 500 or even 100 should not be touched? The question I have is 'how do I modify the script to hit tables with less than 500 pages?' and How can I determine what or which type of scan that is being used on these particular tables. I don't think I want a table with less than 1000 pages using seek as opposed to scan?
dmoldovan
dmoldovan
Old Hand
Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)

Group: General Forum Members
Points: 382 Visits: 1454
Indeed the "small" tables won't be "touched" - in most of the cases.
See http://sqlserverpedia.com/blog/sql-server-bloggers/index-fragmentation-findings-part-2-size-matters/ for some relevant numbers.
See also SQL 2005 BOL ---> Reorganizing and Rebuilding Indexes - there is a "note" regarding the small indexes.
Rudyx - the Doctor
Rudyx - the Doctor
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3290 Visits: 2476
The solution is:
1) not to use maintenance plans
2) add FULLSCAN
3) write a better script (Hint: there are lots out in SSC)

Some best practices:
1) do not try to defragment heaps
2) do not defragment indexes with less than 8 pages (1 extent)
3) do defragment the index if it is more than 10% fragmented
4) do reindex if the index is more than 30% fragmented

Regards
Rudy Komacsar
Senior Database Administrator

"Ave Caesar! - Morituri te salutamus."
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