From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joel Jacobson <joel@compiler.org>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Planning time grows exponentially with levels of nested views
Date: Sun, 18 Apr 2021 16:41:53 -0400
Message-ID: <141461.1618778513@sss.pgh.pa.us> (raw)
In-Reply-To: <140747.1618776847@sss.pgh.pa.us>
References: <797aff54-b49b-4914-9ff9-aa42564a4d7d@www.fastmail.com>
<140747.1618776847@sss.pgh.pa.us>
I wrote:
> If multiple references are actually possible then this'd break it. There
> seem to be no such cases in the regression tests though, and I'm having a
> hard time wrapping my brain around what would cause it. "git blame"
> traces this text to my own commit f44639e1b, which has the log entry
> Don't crash if subquery appears multiple times in jointree. This should
> not happen anyway, but let's try not to get completely confused if it does
> (due to rewriter bugs or whatever).
> so I'm thinking that this was only hypothetical.
Ah, found it. That was evidently a reaction to the immediately preceding
commit (352871ac9), which fixed a rewriter bug that could lead to exactly
the case of multiple jointree references to one RTE.
I think this patch doesn't make things any worse for such a case though.
If we re-introduced such a bug, the result would be an immediate null
pointer crash while trying to process the second reference to a
flattenable subquery. That's probably better for debuggability than
what happens now, where we just silently process the duplicate reference.
Anyway, I've stuck this into the next CF for future consideration.
regards, tom lane
PS: to save time for anyone else who wants to investigate this,
it looks like the report mentioned in 352871ac9 was
https://www.postgresql.org/message-id/007401c0860d%24bed809a0%241001a8c0%40archonet.com
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, joel@compiler.org, pgsql-hackers@lists.postgresql.org
Subject: Re: Planning time grows exponentially with levels of nested views
In-Reply-To: <141461.1618778513@sss.pgh.pa.us>
References: <797aff54-b49b-4914-9ff9-aa42564a4d7d@www.fastmail.com> <140747.1618776847@sss.pgh.pa.us> <141461.1618778513@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