pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: gzh <gzhcoder@126.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re:Re: Different execution plan between PostgreSQL 8.2 and 12.5
Date: Thu, 18 Aug 2022 19:59:35 +0800 (CST)
Message-ID: <3c256567.672e.182b0d2b6e2.Coremail.gzhcoder@126.com> (raw)
In-Reply-To: <CAApHDvq=UeFaPf-f0dRSDAk8JXRuUZuBOBPm684aLnzvJeihpw@mail.gmail.com>
References: <6614e60.204d.182aee5aff0.Coremail.gzhcoder@126.com>
	<2228588.1660793542@sss.pgh.pa.us>
	<CAApHDvq=UeFaPf-f0dRSDAk8JXRuUZuBOBPm684aLnzvJeihpw@mail.gmail.com>

Dear David,


Thanks for your reply.
>In addition to that, I couldn't help notice that the quoted SQL does
>not seem to belong to the explain.  The EXPLAIN has a Limit node, but
>the query does not. I'm assuming this isn't due to the relations being
>views since we don't pull up subqueries with a LIMIT.
LIMIT node because I connect PostgreSQL with A5M2, the tool will add LIMIT when outputting the execution plan, please ignore it.



















At 2022-08-18 11:38:58, "David Rowley" <dgrowleyml@gmail.com> wrote:
>On Thu, 18 Aug 2022 at 15:32, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The 12.5 plan looks like it thinks that the join condition is not
>> hashable --- and probably not mergeable as well, else it would have
>> done a mergejoin.  This is odd if we assume that the lower()
>> outputs are just text.  But you haven't said anything about the
>> data types involved, nor what locale setting you're using, nor
>> what nondefault settings or extensions you might be using, so
>> speculation about the cause would just be speculation.
>
>In addition to that, I couldn't help notice that the quoted SQL does
>not seem to belong to the explain.  The EXPLAIN has a Limit node, but
>the query does not. I'm assuming this isn't due to the relations being
>views since we don't pull up subqueries with a LIMIT.
>
>The costs for the 12.5 are cheaper than 8.4's, so I imagine the more
>likely cause is the planner favouring an early startup plan.
>
>It's probably more likely that lower() is providing the planner with
>bad estimates and there's likely far less than the expected rows,
>resulting in the LIMIT 10000 being a much larger proportion of the
>total rows than the planner expects.
>
>David


view thread (35+ messages)  latest in thread

Message-ID: <3c256567.672e.182b0d2b6e2.Coremail.gzhcoder@126.com>
Permalink:  ../3c256567.672e.182b0d2b6e2.Coremail.gzhcoder@126.com/
Also on:    postgresql.org/message-id/3c256567.672e.182b0d2b6e2.Coremail.gzhcoder@126.com

 · 

reply

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: gzhcoder@126.com, dgrowleyml@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Different execution plan between PostgreSQL 8.2 and 12.5
  In-Reply-To: <3c256567.672e.182b0d2b6e2.Coremail.gzhcoder@126.com>
  References: <6614e60.204d.182aee5aff0.Coremail.gzhcoder@126.com> <2228588.1660793542@sss.pgh.pa.us> <CAApHDvq=UeFaPf-f0dRSDAk8JXRuUZuBOBPm684aLnzvJeihpw@mail.gmail.com> <3c256567.672e.182b0d2b6e2.Coremail.gzhcoder@126.com>

* 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