Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Create index with DROP_Existing Expand / Collapse
Author
Message
Posted Thursday, August 16, 2012 1:26 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, May 3, 2014 6:20 PM
Points: 114, Visits: 396
Some Questions about Create index ... with Drop_Existing

1) in case of Create Clustered index ... with Drop_existing=on non-clustered indexes are rebuilt only once using this option or not at all if the key definition is the same.Is this done by creating another copy of the clustered index(and keeping the old one until the new clustered index is created) or it places some locks on the non-clustered index and defers rebuilding that (if necessary) until the new clustered index is created?

2)in case of Create Non-Clustered index ... with Drop_existing=on what does it exactly do?are users able to use the non-clustered index during build process?


Cheers ,
Pooyan D
________________________________________________
Microsoft Certified Technology Specialist : SQL Server 2008
Post #1346220
Posted Friday, August 17, 2012 4:20 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 12:12 PM
Points: 15,517, Visits: 27,896
Drop does exactly what it says. It's going to drop the existing index and then rebuild it. No, it won't leave the existing index available while it does the rebuild... unless you're also doing ONLINE operations with the index. Then the other index will stay in place while the create operation occurs. This will take extra tempdb space, so be ready for that.

----------------------------------------------------
"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 #1346455
Posted Friday, August 17, 2012 11:38 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, May 3, 2014 6:20 PM
Points: 114, Visits: 396
So there's no difference between using DROP_EXISTING=ON,ONLINE=OFF and dropping and recreating a non-Clustered index .Is there?

Cheers ,
Pooyan D
________________________________________________
Microsoft Certified Technology Specialist : SQL Server 2008
Post #1346688
Posted Friday, August 17, 2012 11:49 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 2:44 PM
Points: 42,443, Visits: 35,498
Other than that with drop.. create there's potential for queries to use the table between the drop and the create, no.


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 #1346691
Posted Friday, August 17, 2012 12:06 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, May 3, 2014 6:20 PM
Points: 114, Visits: 396
Thanks

Cheers ,
Pooyan D
________________________________________________
Microsoft Certified Technology Specialist : SQL Server 2008
Post #1346694
Posted Monday, August 20, 2012 6:09 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 9:39 PM
Points: 397, Visits: 2,414
Grant Fritchey (8/17/2012)
Drop does exactly what it says. It's going to drop the existing index and then rebuild it. No, it won't leave the existing index available while it does the rebuild... unless you're also doing ONLINE operations with the index. Then the other index will stay in place while the create operation occurs. This will take extra tempdb space, so be ready for that.


Can u rebuild index online? I thought index rebuild must be offline, index reorg is done online. Please advise.

Thanks,
SueTons


Regards,
SQLisAwe5oMe.
Post #1347117
Posted Monday, August 20, 2012 6:28 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 2:44 PM
Points: 42,443, Visits: 35,498
Sure you can. Use the ONLINE keyword when rebuilding the 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 #1347130
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse