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 1erszh-000618-MI for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Mar 2018 22:17:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erszg-00051V-Ll for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Mar 2018 22:17:36 +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 1erszg-00051M-EG for pgsql-hackers@lists.postgresql.org; Fri, 02 Mar 2018 22:17:36 +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 1erszd-0006Nt-Ck for pgsql-hackers@lists.postgresql.org; Fri, 02 Mar 2018 22:17:35 +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 w22MHTCO032702; Fri, 2 Mar 2018 17:17:29 -0500 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: <20180302140037.00af305d@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> <101dd073-1cb7-b471-7eeb-aa9ee928a1c9@postgrespro.ru> <20180302140037.00af305d@engels> Comments: In-reply-to David Gould message dated "Fri, 02 Mar 2018 14:00:37 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32700.1520029049.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 02 Mar 2018 17:17:29 -0500 Message-ID: <32701.1520029049@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Gould writes: > I'm confused at this point, I provided a patch that addresses this and a > test case. We seem to be discussing everything as if we first noticed th= e > issue. Have you reviewed the patch and and attached analysis and tested = it? > Please commment on that? I've looked at the patch. The questions in my mind are (1) do we really want to go over to treating ANALYZE's tuple density result as gospel, contradicting the entire thrust of the 2011 discussion? (2) what should we do in the VACUUM case? Alexander's argument seems to apply with just as much force to the VACUUM case, so either you discount that or you conclude that VACUUM needs adjustment too. > This tables reltuples is 18 times the actual row count. It will never co= nverge > because with 50000953 pages analyze can only adjust reltuples by 0.0006 = each time. But by the same token, analyze only looked at 0.0006 of the pages. It's nice that for you, that's enough to get a robust estimate of the density everywhere; but I have a nasty feeling that that won't hold good for everybody. The whole motivation of the 2011 discussion, and the issue that is also seen in some other nearby discussions, is that the density can vary wildly. regards, tom lane