Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1evljO-0001bI-KK for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Mar 2018 15:20:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1evljM-0006iT-HO for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Mar 2018 15:20:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1evljM-0006iK-AR for pgsql-hackers@lists.postgresql.org; Tue, 13 Mar 2018 15:20:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1evljI-00075G-Ai for pgsql-hackers@lists.postgresql.org; Tue, 13 Mar 2018 15:20:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w2DFKdGT000998; Tue, 13 Mar 2018 11:20:39 -0400 From: Tom Lane To: David Gould cc: Alexander Kuzmenkov , pgsql-hackers@lists.postgresql.org, Alina Alexeeva , Ullas Lakkur Raghavendra Subject: Re: [patch] BUG #15005: ANALYZE can make pg_class.reltuples inaccurate. In-reply-to: <20180313001440.581b6662@engels> References: <20180117164916.3fdcf2e9@engels> <20180228192337.67cc3f99@engels> <4988c54a-1709-a978-9a43-65f8a1e09e94@postgrespro.ru> <18522.1519916974@sss.pgh.pa.us> <1386effe-0e6d-fd5a-6f0d-f294e4ef2dda@postgrespro.ru> <3240.1519948160@sss.pgh.pa.us> <20180302161840.3530921f@engels> <28773.1520357803@sss.pgh.pa.us> <6981.1520871694@sss.pgh.pa.us> <20180313001440.581b6662@engels> Comments: In-reply-to David Gould message dated "Tue, 13 Mar 2018 00:14:40 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <996.1520954439.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 13 Mar 2018 11:20:39 -0400 Message-ID: <997.1520954439@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Gould writes: > I also thought about the theory and am confident that there really is no= way > to trick it. Basically if there are enough pages that are different to a= ffect > the overall density, say 10% empty or so, there is no way a random sampl= e > larger than a few hundred probes can miss them no matter how big the tab= le is. > If there are few enough pages to "hide" from the sample, then they are s= o few > they don't matter anyway. > After all this my vote is for back patching too. I don't see any case wh= ere > the patched analyze is or could be worse than what we are doing. I'm hap= py to > provide my test cases if anyone is interested. Yeah, you have a point. I'm still worried about unexpected side-effects, but it seems like overall this is very unlikely to hurt anyone. I'll back-patch (minus the removal of the unneeded vac_estimate_reltuples argument). regards, tom lane