Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mD9ev-0007it-6k for pgsql-docs@arkaria.postgresql.org; Mon, 09 Aug 2021 18:05:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mD9et-0002iV-Ql for pgsql-docs@arkaria.postgresql.org; Mon, 09 Aug 2021 18:05:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mD9et-0002iN-Kh for pgsql-docs@lists.postgresql.org; Mon, 09 Aug 2021 18:05:55 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mD9ep-00029U-3t for pgsql-docs@lists.postgresql.org; Mon, 09 Aug 2021 18:05:54 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1mD9eo-0006HH-HF; Mon, 09 Aug 2021 14:05:50 -0400 Date: Mon, 9 Aug 2021 14:05:50 -0400 From: Bruce Momjian To: "David G. Johnston" Cc: ivanmulhin@gmail.com, Pg Docs , Tom Lane Subject: Re: incorrect information in documentation Message-ID: <20210809180550.GC14370@momjian.us> References: <162851358008.709.11763395628268716122@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Aug 9, 2021 at 09:20:53AM -0700, David G. Johnston wrote: > On Mon, Aug 9, 2021 at 9:06 AM David G. Johnston > wrote: > > On Mon, Aug 9, 2021 at 8:02 AM PG Doc comments form > 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. Nice, can you provide a patch please? -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.