slow sqlite insert using the jdbc drivers in java

前端 未结 2 656
死守一世寂寞
死守一世寂寞 2021-01-11 14:26

I just inserted 1million records into a simple sqlite table with five columns. It took a whooping 18 hours in java using the jdbc drivers! I did the same thing in python2.5

相关标签:
2条回答
  • 2021-01-11 15:05

    Did you have your queries autocommitted? That could explain why it took so long. Try wrapping them in a begin / end so that it doesn't have to do a full commit for every insert.

    This page explains begin/end transaction, while the FAQ touches on inserts/autocommits.

    0 讨论(0)
  • 2021-01-11 15:05

    If you want to further optimize, you can look into batching your insert queries together. So you can change 1 million inserts to 1000 inserts of 1000 batches.

    0 讨论(0)
提交回复
热议问题