From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: dqetool@126.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18764: server closed the connection unexpectedly
Date: Wed, 08 Jan 2025 23:14:38 -0500
Message-ID: <1795556.1736396078@sss.pgh.pa.us> (raw)
In-Reply-To: <CAApHDvo8FfuOiXYnJ1n2fZh8nwrDwkSU7=k6So+u-pYDOkN4YQ@mail.gmail.com>
References: <18764-63ad667ea26e877a@postgresql.org>
<446342.1735923417@sss.pgh.pa.us>
<468120.1735927103@sss.pgh.pa.us>
<CAApHDvo8FfuOiXYnJ1n2fZh8nwrDwkSU7=k6So+u-pYDOkN4YQ@mail.gmail.com>
David Rowley <dgrowleyml@gmail.com> writes:
> On Sat, 4 Jan 2025 at 06:58, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> There is no value in forcing a sort of the subquery's output,
>> and the previous code didn't do so:
> The reason for the 2nd sort, (ignoring the invalidity of the pathkeys)
> is due to how build_setop_child_paths() tries sorting the
> cheapest_input_path. The problem is that the sorted path gets added
> to the same RelOptInfo as the cheapest_input_path so if add_path()
> sees they're fuzzily the same cost, the sorted has better pathkeys, so
> the actual cheapest path is thrown away. I think the reason this
> happens in this case is that there are just not that many rows to
> sort, and it's fairly expensive to get those rows.
Yeah, same conclusion Richard and I came to. It's not that big a
problem (aside from the validity issue) because this path would only
win if the sorting cost is estimated to be insignificant relative
to the subquery's other costs. So while it might be nice to improve
that in future, I'm not very concerned about it now.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, dqetool@126.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18764: server closed the connection unexpectedly
In-Reply-To: <1795556.1736396078@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