On 21 Jan 2012, at 5:49pm, Ryan Johnson wrote:

> In one case the optimizer seems to make a different decision depending on 
> which order I write the join in; in the other case, the join ordering chosen 
> is bad and compounded by an expensive subquery not being materialized into a 
> transient table as it should be.
> 
> For the first issue, consider the following query:
> 
> select count(*) from orders O, Customer C where C.custkey=O.custkey and 
> C.name like '%115';

I see no JOIN.  I see a WHERE.  And it's not clear to me what you're trying to 
count: orders or customers.  I don't know if SQLite can work it out so try one 
of the following:

select count(*) from orders O JOIN Customer C ON C.custkey=O.custkey WHERE 
C.name like '%115';

select count(*) from Customer C JOIN orders O ON C.custkey=O.custkey WHERE 
C.name like '%115';

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to