On Mon, May 18, 2009 at 7:47 AM, Sublimity Mobile Software
<[email protected]> wrote:
>
> Hi,
>
> Currently i'm working on a database system for some applications. I
> need to do a lot of queries to load data from the database into the
> application. After being amazed how much time it took to do these
> queries on the database i found out that much time was consumed by
> cursor.MoveToFirst(). This functions costs currently ~25% of all my
> database action.

If you rearrange your code to call getCount() first, you'll find that
getCount() took most of the time.
Basically, it's actually fetching the data that's taking most of the
time, and that data fetch is not done inside query(), but afterwards,
usually as a result of calling getCount(), which calls fillWindow(),
which then fetches the data. moveToFirst() calls getCount()
internally.
If calling getCount() takes too long, then your query is taking too
long. Try optimizing it by using an index, returning less columns,
etc.

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

Reply via email to