Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3419] Android - SQLite insert is very slow

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2017-07-27T21:05:33.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, defect, klist, reported-1.6.1, rplist, sqlite
ReporterPedro Enrique
AssigneeIngo Muschenetz
Created2011-04-15T03:44:54.000+0000
Updated2017-07-27T21:05:33.000+0000

Description

A http://developer.appcelerator.com/helpdesk/view/76471">helpdesk ticket has reported that inserting rows in a SQLite database takes too long. I have create a sample app and ran it against both Android and iOS. This is the code: http://pastie.org/private/iar8wglepgcilffp6tnpra">link to the code

And in http://pedruqui.s3.amazonaws.com/20110322222050.png">this image you can see the difference between both platforms in milliseconds after the insert.

Tested Agains iPhone Simulator 4.3 and Android APIs 2.2
Titanium SDK 1.6.1

Comments

  1. fluff 2011-05-11

    This is still the case in 1.7.0/upstream.. Any love/fix coming?
  2. Don Thorp 2011-05-11

    Significant time has been invested trying to find a speedup. The underlying implementation seems to be the gating factor. More research will be done, but it won't be fixed in 1.7.0. It may not be fixable.
  3. Paul Hamilton 2012-01-05

    Any updates on this? Working on a project that could send thousands of insert statements to a user. In an iphone, this takes fractions of a second. In Android this takes quite some time. using 1.8 sdk
  4. Paul Hamilton 2012-01-05

    using this tip i found on stack overflow: http://stackoverflow.com/questions/1609637/is-it-possible-to-insert-multiple-rows-at-a-time-in-an-sqlite-database. See comments 2 and 3. i was able to cut the time for 10,000 records to about 25 seconds, roughly a 1/3 reduction in time. Which is still significant... but worthwhile to note. I modified the above user's code to support multiple inserts at a time, in 500 blocks. http://pastie.org/3134463 edit: also worth noting that while using this trick, the time for inserts on an iphone went from around 1.3 seconds to about 50ms. Worth using it all around.
  5. Lee Morris 2017-07-27

    Closing due to inactivity. If this issue still exists, please raise a new ticket.

JSON Source