On Jun 30, 8:46 am, sasq <[email protected]> wrote:
> On Jun 30, 2:36 pm, skink <[email protected]> wrote:
>
> > On Jun 30, 2:24 pm, sasq <[email protected]> wrote:
>
> > > If I involve a second column - even though the first condition limits
> > > the result set to just 20-30 rows - it takes over 10 seconds again,
> > > meaning it will be much faster to just search on the indexed column
> > > and then use java code to sort out the other criteria.
>
> > > Is it simply that sqlite sucks - at least on Android ?
>
> > > -- Sasq
>

Sasq,

SQLite is not the best DB out there, but it is definitely not to bad,
and the Android abstractions are not to bad either. It is much more
likely that you are doing something that is very very expensive, and
blaming it on Android / SQLite.

As a general note, if you can post your DB structure (for example, a
CREATE statement that would create your database) and your exact query
then you will likely get a much faster/better answer.

To explain skinks query optimization, your AND is likely not being
'short-circuited' correctly(I am hazy here, I know what mySQL would
do, but not SQLite), and you may in fact be scanning your entire DB.
TO ensure that you only perform the LIKE on the results that match the
faster/cheaper clause, you perform one select using the index, and
then you perform a select on the returned columns with the LIKE.
Typically much faster

Also, I noticed that you mention you indexed the column that you did a
LIKE on. This is likely not what you want to do. Given that you are
doing a LIKE anyways, this is probably a large column, and a huge
index that is mostly useless and could actually slow down your query.

Generally speaking, performing LIKE on any database is slow, so if you
can avoid it that would be better. If you can post your structure and
query, perhaps we can figure out a way to get the same results without
a LIKE.

Thanks,
Hamy

PS - skink, would you reference your previous post? I would like to
read it!

--~--~---------~--~----~------------~-------~--~----~
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