From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephen Frost <sfrost@snowman.net>
Cc: moe1234512345@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12760: Lateral files with more than 2 laterals
Date: Tue, 10 Feb 2015 19:04:33 -0500
Message-ID: <4213.1423613073@sss.pgh.pa.us> (raw)
In-Reply-To: <20150210230833.GQ3854@tamriel.snowman.net>
References: <20150210224138.18788.34504@wrigleys.postgresql.org>
<20150210230833.GQ3854@tamriel.snowman.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Stephen Frost <sfrost@snowman.net> writes:
> Looks like an issue where GEQO and LATERAL don't get along. :/
On inspection, it seems like the error check that this is triggering is
just plain wrong.
What's happening is that the geqo pool initialization code
(random_init_pool) is proposing the join order A, C0, B0 (1, 3, 2);
which cannot work in this example because B0 (rel 2) has to be joined to A
before C0 is. Now merge_clump first tries to join A and C0 (1 and 3),
which is legal although it generates only a path parameterized by B0.
Then there is no way to join that to B0 (rel 2) since each side of the
join is wanting to be parameterized by the other.
You could argue that desirable_join should figure out that the 1+3 join
isn't so desirable; but that would still not prevent dead-end joins
like this from being made once gimme_tree starts setting the "force"
parameter. Or you could argue that gimme_tree+merge_clump should be
willing to back off and try another clumping once they realize that what
they're doing is a dead end. That seems pretty complicated.
On the whole, it seems like the best choice is to allow overall failure,
since we're certainly going to try other tours anyway. My recollection is
that this code used to have a failure case, which it handled by returning
DBL_MAX as the estimated cost of the tour. We got rid of that at some
point, essentially assuming that this logic could always succeed at
finding a legal join order --- but considering that it's fundamentally a
heuristic, it doesn't seem too bright to assume that it will *always* find
one.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, sfrost@snowman.net, moe1234512345@gmail.com
Subject: Re: BUG #12760: Lateral files with more than 2 laterals
In-Reply-To: <4213.1423613073@sss.pgh.pa.us>
References: <20150210224138.18788.34504@wrigleys.postgresql.org> <20150210230833.GQ3854@tamriel.snowman.net> <4213.1423613073@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox