"Baudracco Pierre" <pierre(dot)baudracco(at)aliasource(dot)fr> writes:
> on a simple data model (a contact, linked to a company and categories
> categorizing a contact) this query takes more than 30 seconds !
> ...
> If I invert (only change) the LEFT JOIN clause the queries returns
> immediately
Existing Postgres releases do not consider rearranging the order of
outer joins, because they don't have the logic needed to determine
whether it's safe (will give the same answer) or not to change the
join order. 8.2 will be smarter.
regards, tom lane