From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: gzh <gzhcoder@126.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Different execution plan between PostgreSQL 8.4 and 12.11
Date: Tue, 11 Oct 2022 10:30:53 -0400
Message-ID: <Y0V+HaTMlgt04hk3@momjian.us> (raw)
In-Reply-To: <299199.1665496783@sss.pgh.pa.us>
References: <23fe7e4b.5866.183bc03584f.Coremail.gzhcoder@126.com>
<3810464.1665331329@sss.pgh.pa.us>
<3bb0d13f.1d81.183bfbcf7e4.Coremail.gzhcoder@126.com>
<3977622.1665369954@sss.pgh.pa.us>
<5cac5c06.25be.183c507f02f.Coremail.gzhcoder@126.com>
<CAApHDvr3EpRpuFxrW6pag8KhG8V_yPO_0BriMhcY_337ELY+nQ@mail.gmail.com>
<299199.1665496783@sss.pgh.pa.us>
On Tue, Oct 11, 2022 at 09:59:43AM -0400, Tom Lane wrote:
> David Rowley <dgrowleyml@gmail.com> writes:
> > It feels like something is a bit lacking in our cost model here. I'm
> > just not sure what that is.
>
> The example you show is the same old problem that we've understood for
> decades: for cost-estimation purposes, we assume that matching rows
> are more or less evenly distributed in the table. Their actual
> location doesn't matter that much if you're scanning the whole table;
> but if you're hoping that a LIMIT will be able to stop after scanning
> just a few rows, it does matter.
We do have a correlation statistics value for each column but I am
unclear if that would help here.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Indecision is a decision. Inaction is an action. Mark Batterson
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: bruce@momjian.us, tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, gzhcoder@126.com
Subject: Re: Different execution plan between PostgreSQL 8.4 and 12.11
In-Reply-To: <Y0V+HaTMlgt04hk3@momjian.us>
References: <23fe7e4b.5866.183bc03584f.Coremail.gzhcoder@126.com> <3810464.1665331329@sss.pgh.pa.us> <3bb0d13f.1d81.183bfbcf7e4.Coremail.gzhcoder@126.com> <3977622.1665369954@sss.pgh.pa.us> <5cac5c06.25be.183c507f02f.Coremail.gzhcoder@126.com> <CAApHDvr3EpRpuFxrW6pag8KhG8V_yPO_0BriMhcY_337ELY+nQ@mail.gmail.com> <299199.1665496783@sss.pgh.pa.us> <Y0V+HaTMlgt04hk3@momjian.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