Re: WIP Join Removal

Tom Lane <[email protected]> Tue, 02 Sep 2008 12:35:21 -0400
Newsgroups gmane.comp.db.postgresql.devel.patches
Message-ID <[email protected]>
Simon Riggs <[email protected]> writes:
> + 	if (removable && 
> + 		joinrel->cheapest_total_path < keeprel->cheapest_total_path)
> + 	{
> + 		elog(LOG, "join removed");
> + 		joinrel->pathlist = keeprel->pathlist;
> + 		joinrel->joininfo = keeprel->baserestrictinfo;
> + 	}
> + }

On third thought: if you think that the join paths could possibly win,
then the correct coding here is something like

	foreach(path, keeprel->pathlist)
		add_path(joinrel, ...)

The reason is that it's not an all-or-nothing choice: some of the paths
might offer cheaper startup cost, or present a useful sort order.
So just present them as available alternatives and let add_path sort it
out.

			regards, tom lane

-- 
Sent via pgsql-patches mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches