Re: [sqlite] seeking answers for a few questions about indexes

2006-05-29 Thread Joe Wilson
> 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);

Re: [sqlite] seeking answers for a few questions about indexes

2006-05-26 Thread drh
"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

Re: [sqlite] seeking answers for a few questions about indexes

2006-05-26 Thread A. Pagaltzis
* 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

[sqlite] seeking answers for a few questions about indexes

2006-05-26 Thread Brannon King
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