public inbox for [email protected]
help / color / mirror / Atom feedFrom: David G. Johnston <[email protected]>
To: Bruce Momjian <[email protected]>
Cc: [email protected]
Cc: Pg Docs <[email protected]>
Cc: Tom Lane <[email protected]>
Subject: Re: incorrect information in documentation
Date: Mon, 9 Aug 2021 20:40:20 -0700
Message-ID: <CAKFQuwaV87e4sdFdZab4+zcUdza+EpveQi_98=f9wJ1+QLUALw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CAKFQuwbHsQ14v3i4oEwPOmgEBqEFjG4i=WsuOMmP2q82myvdQQ@mail.gmail.com>
<CAKFQuwYQacXmG9zMcOgbBtGp-1QusGjXQBfMez9GcHpv=AX6SQ@mail.gmail.com>
<[email protected]>
On Mon, Aug 9, 2021 at 11:05 AM Bruce Momjian <[email protected]> wrote:
>
> > selectivity = (1 - null_frac1) * (1 - null_frac2) * min(1/
> > num_distinct1,
> > 1/num_distinct2)
> > = (1 - 0) * (1 - 0) / max(10000, 10000)
> > = 0.0001
>
> Nice, can you provide a patch please?
>
>
Change the line:
selectivity = (1 - null_frac1) * (1 - null_frac2) * min(1/num_distinct1,
1/num_distinct2)
to be:
selectivity = (1 - null_frac1) * (1 - null_frac2) / max(num_distinct1,
num_distinct2)
The wording already talks about "divide by max".
Though:
"so we use an algorithm that relies only on the number of distinct values
for both relations together with their null fractions:"
maybe adds a parenthetical note:
"so we use an algorithm that relies only on the number of distinct values
(the row count estimate for the whole table, not the -1 in the column
statistics) for both relations together with their null fractions:"
Just note I haven't tried to absorb that whole page, let alone the
implementation, and am not all that familiar with this part of PostgreSQL.
Its seems right, though, in isolation.
David J.
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: incorrect information in documentation
In-Reply-To: <CAKFQuwaV87e4sdFdZab4+zcUdza+EpveQi_98=f9wJ1+QLUALw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox