How to speed up INSERT
Posted: Mon 26 Jun 2006 19:43
I have about 160 million records to import into one master table and one child table. All input records are in various .csv files. To improve the speed of insert I did not define all the indexes on the table, except two. Table has IDENTITY field as PK and one digest field which is binary(16) and it is an IX. I check for duplicates on this digest field.
I use MSQuery to import. I have an output IDENTITY parameter (SET :RowId=SCOPE_IDENTITY()). I need IDENTITY to insert row into child table. I start transaction and then every 10,000 rows I commit it and start a new one.
Whole process is painfully slow. It is inserting about 60 rows a second.
Questions:
1. How can I improve the performance?
2. I have a feeling that MSQuery is doing AutoCommit after every INSERT (regardless of transaction). Is that true and, if it is, how do I disable it?
Any help is appreciated.
Thanks
BDS2006, SDAC 3.70, SQL Server 2005 SP1, WinXP Pro SP2, 4GB RAM, 500GB Hard Disk
I use MSQuery to import. I have an output IDENTITY parameter (SET :RowId=SCOPE_IDENTITY()). I need IDENTITY to insert row into child table. I start transaction and then every 10,000 rows I commit it and start a new one.
Whole process is painfully slow. It is inserting about 60 rows a second.
Questions:
1. How can I improve the performance?
2. I have a feeling that MSQuery is doing AutoCommit after every INSERT (regardless of transaction). Is that true and, if it is, how do I disable it?
Any help is appreciated.
Thanks
BDS2006, SDAC 3.70, SQL Server 2005 SP1, WinXP Pro SP2, 4GB RAM, 500GB Hard Disk