>Yes, but it completes the first query in 1ms somehow, so where is the
>difference ?

>From your original email...

>WHERE channel = ? AND time >= ?
>ORDER BY time ASC "

>WHERE channel IN (-2,?) AND time >= ?
>ORDER BY time ASC "

.. the WHERE clause is different, that is why you are getting the
different processing times. I think you are actually trying to find out
why 1 query is 200x faster than the other.

There could be a few reasons why they are different - One possible
reason is that you have a large number of records where the channel
value is set to "-2". Dan has also given a suggestion to try a different
approach to get the same answer to the second query.

Without giving more information, there is a limit to how much help
members of this list can give. You may wish to post the results of the
following queries which may help identify your problem.

SELECT count(*)
FROM files
WHERE channel = ? AND time >= ?
ORDER BY time ASC "
LIMIT ?

SELECT count(*)
FROM files
WHERE channel IN (-2,?) AND time >= ?
ORDER BY time ASC "
LIMIT ?

Also tell us the values used for the "?"

As I mentioned earlier, try using the EXPLAIN keyword which describes
how the internals of SQLite are working. If you have difficulty in
understanding the output of EXPLAIN, post the results to this mailing
list and I'm sure someone (with greater knowledge of this command than
myself) will respond.

Nick















********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

Reply via email to