Jonas Sandman wrote:
> But I guess the answer is that only the "where" parts should be
> indexed, not the id's in the joins?

No, that's generally not true. ON clauses in joins are basically a syntactic 
sugar (though there's a subtle difference in case of outer joins). These three 
statements are equivalent:

select * from animals a
join animaltype at on at.id=a.typeid
where a.name='Monkey' and a.subspecies=2;

select * from animals a, animaltype at
where a.name='Monkey' and a.subspecies=2 and at.id=a.typeid;

select * from animals a join animaltype at on (
    at.id=a.typeid and a.name='Monkey' and a.subspecies=2);

So, whether a particular condition is in WHERE clause or in ON clause is 
immaterial.

Igor Tandetnik

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

Reply via email to