SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reindexing & defragmentation


Reindexing & defragmentation

Author
Message
mjafar
mjafar
SSC-Enthusiastic
SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)

Group: General Forum Members
Points: 127 Visits: 131
Hi all,

Here on daily basis large number of updates/inserts/fetching are happening on database.

On weekly basis I am reindexing & after that defragmenting my data to improve performance.
Is it necessary/good to do defragmentation after reindexing.

If yes then I just have to ask, what i have to do first Reindexing & defragmentation or defragmentation & reindexing or it doesnt matter what is the sequence.
If No, plz tell me difference in defragmentation & reindexing.

Plz reply soon..

Regards
Majid
Steve Jones
Steve Jones
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: Administrators
Points: 62174 Visits: 19102
How are you reindexing? There is reindexing and rebuilding, which operate differently. Read the BOL entries and you'll see that one handles fragmentation.

How do you defragment? You rebuild the index.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
mjafar
mjafar
SSC-Enthusiastic
SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)

Group: General Forum Members
Points: 127 Visits: 131
For rebuilding indexing I used DBCC DBREINDEX and for defragmentation DBCC INDEXDEFRAG

Is it necessary to use both commands or just using DBCC DBREINDEX i can do reindexing as well as defragmentation.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86949 Visits: 45267
Reindex completely rebuilds the index, removing fragmentation at all levels.
Index Defrag shuffles the leaf pages into order, removing fragmentation at the leaf levels, but potentially leaving fragmentation at the other levels of the index.

Doing a defrag right after a reindex is redundant and a waste of time and server resources.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


mjafar
mjafar
SSC-Enthusiastic
SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)

Group: General Forum Members
Points: 127 Visits: 131
If dbcc dbreindex rebuilds indexes also defragment the data then is it necessary to use DBCC INDEXDEFRAG ?

If I am using DBCC INDEXDEFRAG & after that dbcc dbreindex then is it ok?

plz reply...

Regards
Majid
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86949 Visits: 45267
Doing a reindex right after a defrag is redundant and a waste of time and server resources

A reindex does all that a defrag does and more.

You would typically use a defrag is you have only a small window (it's often faster than a reindex) or you need the table accesssible during the defrag. (on SQL 2000, an index rebuild is an offline operation)

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


mjafar
mjafar
SSC-Enthusiastic
SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)

Group: General Forum Members
Points: 127 Visits: 131
ok..ok..
got it..

I will use DBCC dbreindex once a week..

Thanks a lot Gail for guidance.
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