Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Optimize Mass Insert to database

Former Member
0 Likes
523

Hi Experts,

Is there a way to optimize mass inserts to the database?

I did INSERT tabname from TABLE internaltab. this takes a long time.

Any thoughts?

Thanks in advance.

Best Regards,

Rose

2 REPLIES 2
Read only

ThomasZloch
Active Contributor
0 Likes
434

I don't know a better way than the array insert you are mentioning.

If I remember correctly, having the internal table sorted by the primary key of the database table might speed things up somewhat.

It might also be a good idea to mass insert in chunks of e.g. 50K records (depending on row size), with COMMIT WORKs inbetween.

Greetings

Thomas

Read only

Former Member
0 Likes
434

That statement can not be improved, but you should better take care that there are not to many lines in the internal table until you execute a Commit.

The database keeps rollback areas in case if something goes wrong. If they become too large you will see negative performance impact. Therefor you should

split the table into smaller ones of about 10000 lines.

Check

append lines of from index1 to index2.

Insert 10.000 lines and commit and insert again.

This should work fine.

Siegfried