Eliminating unnecessary left joins - Mailing list pgsql-hackers

From Ottó Havasvölgyi
Subject Eliminating unnecessary left joins
Date
Msg-id 34608c0c0704061501lb632332l22fa471f118ddea3@mail.gmail.com
Whole thread Raw
Responses Re: Eliminating unnecessary left joins  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,
 
When using views built with left joins, and then querying against these views, there are a lot of join in the plan that are not necessary, because I don't select/use any column of each table in the views every time. Tables that are left joined and never referenced anywhere else in the query  should be removed from the plan. I think this can be done without any other analyzation or catalog lookup, so it is a quite cheap optimization step, and doing it won't influence the result, but the query will run faster.
This way with a complex query against these views usually the half of the join can be eliminated, and the plan will be quite more optimal.
Why left join a table if never used/referenced in the query?
 
How easy is to teach Postgres to this?
 
I would like to help somehow to introduce this feature as soon as possible. What should I do?
 
Thanks,
Otto

pgsql-hackers by date:

Previous
From: Zdenek Kotala
Date:
Subject: Re: [PATCHES] Fix for large file support
Next
From: Tom Lane
Date:
Subject: Re: [PATCHES] Fix for large file support