Re: Left Outer Join much faster than non-outer Join? - Mailing list pgsql-performance

From Tom Lane
Subject Re: Left Outer Join much faster than non-outer Join?
Date
Msg-id 1755.1112242072@sss.pgh.pa.us
Whole thread Raw
In response to Left Outer Join much faster than non-outer Join?  (rm_pg@cheapcomplexdevices.com)
Responses Re: Left Outer Join much faster than non-outer Join?
List pgsql-performance
rm_pg@cheapcomplexdevices.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

pgsql-performance by date:

Previous
From: John Arbash Meinel
Date:
Subject: Re: fine tuning for logging server
Next
From: Ron Mayer
Date:
Subject: Re: Left Outer Join much faster than non-outer Join?