> The right way to do this query is:
>
> SELECT * FROM vals2d WHERE rowid IN
> (SELECT rowid FROM vals2d WHERE x=1
> UNION ALL SELECT rowid FROM vals2d WHERE y=1);
Unfortunately this tranform does not work on views
or subqueries due to NULL rowids.
sqlite> create table abc(a,b,c);
sq
"A. Pagaltzis" <[EMAIL PROTECTED]> wrote:
> * Brannon King <[EMAIL PROTECTED]> [2006-05-26 21:35]:
> > I would think this would be a valuable optimization for Sqlite
> > to perform automatically. When it finds an OR operation, it
> > should look to see if duplicating the query and using the UNION
>
* Brannon King <[EMAIL PROTECTED]> [2006-05-26 21:35]:
> I would think this would be a valuable optimization for Sqlite
> to perform automatically. When it finds an OR operation, it
> should look to see if duplicating the query and using the UNION
> ALL compounder would allow it to use additional i
I have a table:
CREATE TABLE vals2d (x INTEGER, y INTEGER, val INTEGER);
CREATE UNIQUE INDEX xy ON vals2d (x,y);
EXPLAIN QUERY PLAN SELECT * FROM vals2d WHERE x = 1 OR y = 1;
produces
0|0|TABLE vals2d
The index is unused.
x,y are unique together so I built these indexes:
CREATE INDEX x ON vals
4 matches
Mail list logo