If Uniform has a given EmployeeName twice, you will get the Employee.Name twice 
in this query. Thus it would be a different result than if you did not join 
with Uniform.

David



________________________________
 From: Charles Samuels <char...@cariden.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org> 
Sent: Tuesday, May 29, 2012 8:21 PM
Subject: [sqlite] Why can't sqlite disregard unused outer joins?
 

Suppose you have a query like this:

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

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? Is 
there a way to get sqlite to do so? Is this a planned feature?

Why do I ask? I have a big view that joins a whole bunch of a tables 
(including with a virtual table), but most queries use only a subset of those 
queries actual data and I'd rather not get hit by that performance penalty.

Since my queries come from the user, I don't want to have them do the joins on 
their own, it'd be tedious.

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

Reply via email to