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 2005
»
T-SQL (SS2K5)
»
Dropping indexes
Dropping indexes
Rate Topic
Display Mode
Topic Options
Author
Message
Catcha
Catcha
Posted Thursday, September 13, 2012 7:46 PM
SSC Rookie
Group: General Forum Members
Last Login: Monday, February 11, 2013 11:07 PM
Points: 38,
Visits: 169
Hi All,
I need to drop indexes on a table over 500mil records, I wandering is it better to drop the indexes the following sequence
non-clustered indexes -> primary -> clustered index
or the following
Clustered index -> primary -> non-clustered indexes
I would assume the first one will be slower?
Is my assumption correct?
Post #1359017
sainatth.wagh
sainatth.wagh
Posted Thursday, September 13, 2012 10:17 PM
Grasshopper
Group: General Forum Members
Last Login: Monday, May 20, 2013 3:41 AM
Points: 18,
Visits: 59
Yes. The first one will be slower compared to second since the first one will be doing FTS....I mean Full Table Scan and then based on the inetrnal ordering will delete the indexes.
Post #1359034
Suresh B.
Suresh B.
Posted Thursday, September 13, 2012 10:25 PM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 4:49 AM
Points: 1,075,
Visits: 5,119
How many indexes are there in the table?
Why do you want to delete all the indexes?
Why do you want to delete the primary key as well?
I believe second one would be slower as dropping the CI would rebuild the NC indexes.
Post #1359037
Catcha
Catcha
Posted Thursday, September 13, 2012 10:43 PM
SSC Rookie
Group: General Forum Members
Last Login: Monday, February 11, 2013 11:07 PM
Points: 38,
Visits: 169
4 non-clustered, 1 clustered and 1 primary key.
For bulk insert.
Post #1359039
rhythmk
rhythmk
Posted Friday, September 14, 2012 12:03 AM
Old Hand
Group: General Forum Members
Last Login: Saturday, November 10, 2012 9:30 AM
Points: 388,
Visits: 603
Catcha (9/13/2012)
4 non-clustered, 1 clustered and 1 primary key.
For bulk insert.
But do you think that dropping the index will save your time ?
Because as you mentioned that the table contains millions of records, so I guess to rebuild the indexes will be time taking.
--rhythmk
------------------------------------------------------------------
To post your question use below link
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1359053
Catcha
Catcha
Posted Friday, September 14, 2012 1:02 AM
SSC Rookie
Group: General Forum Members
Last Login: Monday, February 11, 2013 11:07 PM
Points: 38,
Visits: 169
Yes, with recreating the index I will use the following order
Non-clustered -> primary key -> clustered
So rebuilding of whole table will be performed last.
Thought?
Post #1359071
rhythmk
rhythmk
Posted Friday, September 14, 2012 3:49 AM
Old Hand
Group: General Forum Members
Last Login: Saturday, November 10, 2012 9:30 AM
Points: 388,
Visits: 603
Catcha (9/14/2012)
Yes, with recreating the index I will use the following order
Non-clustered -> primary key -> clustered
So rebuilding of whole table will be performed last.
Thought?
Again I would like to know that how many records you are going to insert.As in case the number records are very less than the existing records comparatively, it is recmmonded not to drop the indexes.
Note - The records(500 millions) as you mentioned in your table will break your head during index rebuild.So better to give it a try on development or test environment instead of doing on production.
--rhythmk
------------------------------------------------------------------
To post your question use below link
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1359138
Grant Fritchey
Grant Fritchey
Posted Friday, September 14, 2012 9:02 AM
SSChampion
Group: General Forum Members
Last Login: Today @ 3:41 AM
Points: 13,383,
Visits: 25,189
Catcha (9/14/2012)
Yes, with recreating the index I will use the following order
Non-clustered -> primary key -> clustered
So rebuilding of whole table will be performed last.
Thought?
Nope. Backwards. If you create the clustered index last, it will recreate all the other indexes. Recreating, clustered first, then everything else.
----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #1359375
Catcha
Catcha
Posted Sunday, September 16, 2012 10:49 PM
SSC Rookie
Group: General Forum Members
Last Login: Monday, February 11, 2013 11:07 PM
Points: 38,
Visits: 169
Yes, that makes sense.
Post #1359967
« Prev Topic
|
Next Topic »
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.