From: Tom Lane <tgl@sss.pgh.pa.us>
To: gzh <gzhcoder@126.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Different execution plan between PostgreSQL 8.2 and 12.5
Date: Wed, 17 Aug 2022 23:32:22 -0400
Message-ID: <2228588.1660793542@sss.pgh.pa.us> (raw)
In-Reply-To: <6614e60.204d.182aee5aff0.Coremail.gzhcoder@126.com>
References: <6614e60.204d.182aee5aff0.Coremail.gzhcoder@126.com>
gzh <gzhcoder@126.com> writes:
> I run following sql in PostgreSQL 8.2 and PostgreSQL 12.5, it returns different execution plan.
8.2 is ... well, not stone age maybe, but pretty durn ancient.
You really ought to update a bit more often than that. (And
maybe pay more attention to staying up to date with minor releases?
Whatever was your reasoning for choosing 12.5, when the latest 12.x
release is 12.12?)
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.
There is some advice here about how to ask this sort of
question in a way that would obtain useful answers:
https://wiki.postgresql.org/wiki/Slow_Query_Questions
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 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, gzhcoder@126.com
Subject: Re: Different execution plan between PostgreSQL 8.2 and 12.5
In-Reply-To: <2228588.1660793542@sss.pgh.pa.us>
References: <6614e60.204d.182aee5aff0.Coremail.gzhcoder@126.com> <2228588.1660793542@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