On 21/01/2012 1:01 PM, Simon Slavin wrote:
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.
It's a SQL89 join. Sqlite docs say SQL89 and SQL92 joins perform
identically [1], which I confirmed before sending the OP. The older
syntax just requires less typing, that's all.
The query counts orders made by qualifying customers.
Ryan
[1] http://www.sqlite.org/optoverview.html#joins
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users