Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Table insert is too slow

Author  Topic 

mcrors_calhoun
Starting Member

22 Posts

Posted - 2006-09-08 : 06:51:43
Hi

I have some dynamically generated SQL code that is used to load a table2 with data from table1. There can be anywhere between 10,000 rows to 1,000,000 rows in table1, though it is usually about 10,000 rows. Table1 has about 200 columns.

The load takes about 10 mins(for 10,000 rows). If I output to a file instead of table2 the load takes about 2 mins.

I cannot make any changes to the insert statement itself as it is embedded in some java code that cannot be changed.

I need to make changes to the table to try and speed up the load process. One thing I have tried is to drop the indexes on table2 before the load and then create them again once the table is loaded. This helps, but not by enough.

Is there anything else I can do to help speed things up?

Cheers

nr
SQLTeam MVY

12543 Posts

Posted - 2006-09-08 : 08:21:27
Output to a file then bulk insert that file into the table.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-09-08 : 10:07:18
remove the code from java and put it in a stored proc and have java call that...and then do what Nigel says.

But why keep redundant data in the first place?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page
   

- Advertisement -