Skip to main content
July 21, 2011
Answered

Air for Android - Sqlite - Slow inserts

  • July 21, 2011
  • 2 replies
  • 1174 views

Hello there,

What is the best way to follow in order to make a lot of insert on a sqlite db?

I ask because I noticed a great and unpredicatable slowdown on my Galaxy S when I make a lot of insert.

I use an openAsync connection because I need to monitor what is happening.

Everytime a row is created I increment a counter.

It starts well, then after a 100 insert it slow down and nearly dies.

Any suggestions?

Thanks in advance

This topic has been closed for replies.
Correct answer Nielzz

SQLite is extremly fast, the only true bottleneck is disk-writing. Every Insert needs to be written to disk and is therefor a huge bottleneck.

I had your exact problem on IOS and used Transactions with Begin and Commit to solve it, now inserting thousands of row per second once again

2 replies

NielzzCorrect answer
Inspiring
July 21, 2011

SQLite is extremly fast, the only true bottleneck is disk-writing. Every Insert needs to be written to disk and is therefor a huge bottleneck.

I had your exact problem on IOS and used Transactions with Begin and Commit to solve it, now inserting thousands of row per second once again

July 21, 2011

I optimized the query:

- I reuse the same statement and changing only the parameters

- I use the transaction with begin and commit

This speeded up the whole things in an incredible way, however I still notice a slow down that luckily, after the optimizations I made, never dies.

Any other suggestion will be appreciated!