From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: WIP patch: distinguish selectivity of < from <= and > from >=
Date: Tue, 04 Jul 2017 11:50:21 -0400
Message-ID: <4292.1499183421@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGz5QCKTW6YQNe6Ttqj-Zx_W34vmwz5jP_Cs1KC7j7yHriLVxw@mail.gmail.com>
References: <12232.1499140410@sss.pgh.pa.us>
<CAGz5QCKTW6YQNe6Ttqj-Zx_W34vmwz5jP_Cs1KC7j7yHriLVxw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Kuntal Ghosh <kuntalghosh.2007@gmail.com> writes:
> On Tue, Jul 4, 2017 at 9:23 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> ... I have to admit that I've failed to wrap my brain around exactly
>> why it's correct. The arguments that I've constructed so far seem to
>> point in the direction of applying the opposite correction, which is
>> demonstrably wrong. Perhaps someone whose college statistics class
>> wasn't quite so long ago can explain this satisfactorily?
> I guess that you're referring the last case, i.e.
> explain analyze select * from tenk1 where thousand between 10 and 10;
No, the thing that is bothering me is why it seems to be correct to
apply a positive correction for ">=", a negative correction for "<",
and no correction for "<=" or ">". That seems weird and I can't
construct a plausible explanation for it. I think it might be a
result of the fact that, given a discrete distribution rather than
a continuous one, the histogram boundary values should be understood
as having some "width" rather than being zero-width points on the
distribution axis. But the arguments I tried to fashion on that
basis led to other rules that didn't actually work.
It's also possible that this logic is in fact wrong and it just happens
to give the right answer anyway for uniformly-distributed cases.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, kuntalghosh.2007@gmail.com
Subject: Re: WIP patch: distinguish selectivity of < from <= and > from >=
In-Reply-To: <4292.1499183421@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