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

Primary key question Expand / Collapse
Author
Message
Posted Wednesday, January 23, 2013 2:28 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 1:03 PM
Points: 298, Visits: 1,104
I'm planning to move data from one database to another on the same server. I've DDL scripts ready to create objects on the new database but I'm not sure if I've to create primary keys before loading the data since I think it will slow up the load. So my question is, do I need to create the primary keys before loading or after loading the data?
Post #1410797
Posted Thursday, January 24, 2013 2:34 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 2:20 AM
Points: 5,231, Visits: 5,106
That is one for testing per your environment as either could produce the best result.

I would do a test without the primary key, insert the data, create the primary key and time it.

Then truncate the table and import the data again.

That way you have a time it takes to import and create the key VS time it takes to import with the key existing, then you can make an informed choice.





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 #1411002
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse