Ulrik Petersen wrote:
this is also just a stab in the dark, and I subscribe to the digest
version of the mailinglist, so I may not have the latest.
Perhaps you are doing something like
SELECT A.x, A.y
FROM A
WHERE A.rowid = xxx
OR A.rowid = yyy
OR A.rowid = zzz
OR A.rowid = ...
etc.etc. with may OR-conditions.
I have noticed that SQLite (and PostgreSQL, for that matter) slows down
quite a bit when the number of WHERE-conditions reaches beyond a
somewhat low number, say around 10.
In SQLite, any use of the OR operator in a WHERE clause more or
less shuts down the query optimizer, disables all indices, and
forces a full table scan. If you want to write a query like the
one shown above, do it this way:
SELECT * FROM A
WHERE A.rowid IN (xxx,yyy,zzz,...);
The optimizer understands the IN operator just fine.
SQLite's query optimizer can handle up to 32 AND terms in the
WHERE expression before it begins to have problems.
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]