Re: incorrect information in documentation - Mailing list pgsql-docs

From David G. Johnston
Subject Re: incorrect information in documentation
Date
Msg-id CAKFQuwYQacXmG9zMcOgbBtGp-1QusGjXQBfMez9GcHpv=AX6SQ@mail.gmail.com
Whole thread Raw
In response to Re: incorrect information in documentation  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: incorrect information in documentation  (Bruce Momjian <bruce@momjian.us>)
List pgsql-docs
On Mon, Aug 9, 2021 at 9:06 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Mon, Aug 9, 2021 at 8:02 AM PG Doc comments form <noreply@postgresql.org> wrote:
Hello, on page
https://www.postgresql.org/docs/current/row-estimation-examples.html - there
is a example:
selectivity = (1 - null_frac1) * (1 - null_frac2) * min(1/num_distinct1,
1/num_distinct2)
            = (1 - 0) * (1 - 0) / max(10000, 10000)
            = 0.0001
in the first string  " * min" and in the second " / max"
as I understand it isn't correct.

Division is just multiplication by the reciprocal so while the presentation here is inconsistent it is correct.  Likewise, the larger a number the smaller its reciprocal, so the change from min to max also works.  


FWIW this used to be presented with the calculation and formula in sync, but the original had a simple typo in the calculation.  When the typo got fixed back in December of 2007 [1] the author of the patch simplified the calculation at the same time.  I suggest we update the formula line to match the calculation presented.

David J.


pgsql-docs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: incorrect information in documentation
Next
From: Bruce Momjian
Date:
Subject: Re: incorrect information in documentation