On 5/29/2012 8:21 PM, Charles Samuels wrote:
Suppose you have a query like this:

select Employee.name from Employees left join Uniform on
        (EmployeeSize.name=Uniform.employeeName)

Doesn't look like a valid query to me. What's Employee and EmployeeSize? I assume you meant Employees in both places.

This query's result should be identical weather or not we have that join; it's
an outer join, not an inner join, afterall. However, explain query plan (and
my time measurements) seem to indicate that the the query with the join is far
slower/more complex.

Is it hypothetically possible that the optimizer could avoid the join?

In principle, yes.

Is there a way to get sqlite to do so?

Sure. Remove the join from the query.

Is this a planned feature?

Well, it's not a feature, it's a lack thereof. The query planner is not specifically looking for this particular optimization opportunity - probably because such situations are uncommon and are not worth the time looking for. Your question seems to suggest that optimizations magically happen by themselves unless someone specifically writes code to block them; in reality, it's the other way round.
--
Igor Tandetnik

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

Reply via email to