Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 Administration
»
Disable|Enable Index
11 posts, Page 1 of 2
1
2
»»
Disable|Enable Index
Rate Topic
Display Mode
Topic Options
Author
Message
Ratheesh.K.Nair
Ratheesh.K.Nair
Posted Thursday, January 31, 2013 2:55 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 9:03 AM
Points: 2,415,
Visits: 3,374
Hi Experts,
I read in a post that during BCP,BULK INSERT kind of operation we can disable the index using
ALTER INDEX [IX_StoreContact_ContactTypeID] ON Sales.StoreContact DISABLE
and can re-enable it using
ALTER INDEX [IX_StoreContact_ContactTypeID] ON Sales.StoreContact REBUILD
My doubt is whats the difference it makes if we are rebuilding the index at the end? I mean rebuild is just like dropping and recreating index so why cant we drop and recreate instead of disable? Do we have any advantage in disabling?
Thanks IN Advance
Post #1413944
anthony.green
anthony.green
Posted Thursday, January 31, 2013 2:58 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
It is the same you are correct, but with disable / rebuild, you dont need to know the definition of the index to recreate it.
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1413945
Ratheesh.K.Nair
Ratheesh.K.Nair
Posted Thursday, January 31, 2013 3:03 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 9:03 AM
Points: 2,415,
Visits: 3,374
Thanks Antony for the quick reply.
Is that the only advantage?
Post #1413946
anthony.green
anthony.green
Posted Thursday, January 31, 2013 3:06 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
Yes, as disable drops the B-Tree of the index, but leaves the meta data in place, so the only way to get the index enabled again is rebuild, to rebuild the tree.
Drop obivously drops the tree and the meta data, so you need to know the name of the index, the columns of the index etc etc in order to re-create it.
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1413948
Ratheesh.K.Nair
Ratheesh.K.Nair
Posted Thursday, January 31, 2013 3:13 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 9:03 AM
Points: 2,415,
Visits: 3,374
Thanks alot Anthony..
Those details really helps in understanding exactly what happens..
Thanks Again
Post #1413953
GilaMonster
GilaMonster
Posted Thursday, January 31, 2013 3:38 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 5:49 PM
Points: 37,671,
Visits: 29,925
Just don't try and disable the clustered index. There's a large difference there between dropping and disabling.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
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
Post #1413964
Ratheesh.K.Nair
Ratheesh.K.Nair
Posted Thursday, January 31, 2013 6:04 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 9:03 AM
Points: 2,415,
Visits: 3,374
Thanks Gail,
Can you please help me in understanding the difference? or docs or link is highly appreciated.
Post #1414052
GilaMonster
GilaMonster
Posted Thursday, January 31, 2013 6:10 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 5:49 PM
Points: 37,671,
Visits: 29,925
Did you look in Books Online?
Guidelines for Disabling Indexes and Constraints
Disabling Clustered Indexes
The following additional guidelines apply to disabling clustered indexes:
The data rows of the disabled clustered index cannot be accessed except to drop or rebuild the clustered index. This means the following:
These operations will fail: SELECT, UPDATE, DELETE, INSERT, CREATE INDEX, CREATE STATISTICS, UPDATE STATISTICS (on the index), and ALTER TABLE statements that modify table columns or constraints.
These operations will succeed: CREATE VIEW, DROP VIEW, CREATE TRIGGER, DROP TRIGGER, DROP INDEX, ALTER TABLE ENABLE/DISABLE TRIGGER, TRUNCATE TABLE, and DROP TABLE.
Nonclustered indexes cannot be created while the clustered index is disabled.
Existing nonclustered indexes and XML indexes associated with the table are automatically disabled and cannot be accessed.
All clustered and nonclustered indexes on views that reference the table are disabled. These indexes must be rebuilt just as those on the referenced table.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
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
Post #1414057
Ratheesh.K.Nair
Ratheesh.K.Nair
Posted Thursday, January 31, 2013 7:45 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 9:03 AM
Points: 2,415,
Visits: 3,374
Thanks a lot Gail.
Seems like disable is pretty dangerous than drop & recreate.
Post #1414148
GilaMonster
GilaMonster
Posted Thursday, January 31, 2013 8:53 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 5:49 PM
Points: 37,671,
Visits: 29,925
No, not at all.
Just like you wouldn't randomly drop the clustered index (unless you want your table inaccessible for a while and your log to bloat), you wouldn't randomly disable the clustered index.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
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
Post #1414183
« Prev Topic
|
Next Topic »
11 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.