Re: [sqlite] Query efficiency

2011-05-19 Thread Matthew Jones
Subject: Re: [sqlite] Query efficiency That is, is leaving it to the query optimiser to figure out that I only need the sub select once the best thing to do? AFAIK, SQLite's optimizer is not that smart to collapse two identical sub-queries and reuse once generated result. Is the select

Re: [sqlite] Query efficiency

2011-05-19 Thread Jim Morris
You must use the alias if specified: select ar.* from aa ar, ab ab1, ab ab2; rather than select aa.* from aa ar, ab ab1, ab ab2; On 5/19/2011 10:33 AM, Matthew Jones wrote: select aa.* from aa ar, ab ab1, ab ab2; ___ sqlite-users mailing list

Re: [sqlite] Query efficiency

2011-05-19 Thread Pavel Ivanov
At this point I got confused but realised I had asked about a very different schema and obviously must be doing something wrong as this failed before adding any sort of where clause. From: Pavel Ivanovpaiva...@gmail.com Subject: Re: [sqlite] Query efficiency  That is, is leaving it to the  query

[sqlite] Query efficiency

2011-05-17 Thread Matthew Jones
O.k. So this is a very cut down example but it illustrates the question: sqlite create table a (a_id int primary key); sqlite create table b (b_id int primary key); sqlite create table ab (a_id int, b_id int, primary key(a_id, b_id)); sqlite create table a_relation (a_id1 int, a_id2, primary

Re: [sqlite] Query efficiency

2011-05-17 Thread Pavel Ivanov
That is, is leaving it to the query optimiser to figure out that I only need the sub select once the best thing to do? AFAIK, SQLite's optimizer is not that smart to collapse two identical sub-queries and reuse once generated result. Is the select I'm doing where both a_id1 2 are in the