Re: Eliminating unnecessary left joins

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2007-04-06T23:38:39Z
Lists: pgsql-hackers
"=?ISO-8859-1?Q?Ott=F3_Havasv=F6lgyi?=" <havasvolgyi.otto@gmail.com> writes:
> 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.

That might cause you to get the wrong number of copies of some rows ---
what if a row of the left table should join to multiple rows on the right?

			regards, tom lane