rm_pg(at)cheapcomplexdevices(dot)com writes:
> select *
> from streetname_lookup as sl
> join city_lookup as cl on (true)
> left outer join tlid_smaller as ts on (sl.geo_streetname_id = ts.geo_streetname_id and cl.geo_city_id=ts.geo_city_id)
> where str_name='alamo' and city='san antonio' and state='TX'
> ;
That's a fairly odd query; why don't you have any join condition between
streetname_lookup and city_lookup?
The planner won't consider Cartesian joins unless forced to, which is
why it fails to consider the join order "((sl join cl) join ts)" unless
you have an outer join in the mix. I think that's generally a good
heuristic, and am disinclined to remove it ...
regards, tom lane