If you're sure there is nothing to be gained from optimizing the
database itself, then it seems your only option is to not use a
database at all.
Are you *sure* the database/query can't be further optimized? How much
time does your query take anyway?


On Wed, May 20, 2009 at 2:17 AM, Sublimity Mobile Software
<[email protected]> wrote:
>
> Thank you for your reply.
>
> You where right. The getCount() method takes indeed a lot of time. So
> i filled another window by using fillWindow() like this:
>
> Cursor c = db.query(var1, var2, var3 .....);
> SQLiteCursor liteCursor = (SQLiteCursor) c;
> CursorWindow cw = new CursorWindow(true);
> liteCursor.fillWindow(0, cw);
>
> And then looping the CursorWindow to get all rows and columns.
>
> I presumed that this would make a performance boost because i thought
> that by doing this i will cut back on overhead. But this actually
> takes about 40% more time then simply calling getCount() that
> eventually loads the data into the cursor
>
> I already optimized the database and the queries so there is nothing
> to gain here.
>
> But would you there be another way the get values from a database in a
> faster way?
>
> On 19 mei, 02:52, Marco Nelissen <[email protected]> wrote:
>> 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