On Fri, Sep 10, 2010 at 10:11 PM, Sheado <chad...@gmail.com> wrote:
> The issue:
> SQLiteDatabase.update(...) takes anywhere from 30ms to 700ms on a
> simple update (on a Motorola Droid). I'm not sure why there's such a
> huge range in the timing, but despite that it still means that in the
> best case updating one column in 30 rows will take at least one second
> - in the best case! On average updating 30-40 rows is taking me 3-4
> seconds - this is crazy slow - like 1985 computer slow!

No, it's like flash slow. Please watch Brad Fitzpatrick's "Writing
Zippy Android Apps" presentation from the 2010 Google I|O conference.
He covers this very point.

> I've tried:
> * update(...) with ContentValues
> * update with execSql()
> * add/removing indices on the columns in question

None of those should have any effect. You're assuming the problem is
with the CPU. It's not. It is with the flash writes. You need to cut
down on the number of flash writes.

> Is there anything else I can try to improve performance? For example,
> is there any way to update multiple rows with one statement?

As the others on this thread pointed out, use transactions. That will
turn ~30 individual transactions (each with its own set of flash
write) into one.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to