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 1ez6FJ-0008BV-B7 for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Mar 2018 19:51:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ez6FI-0005HS-AK for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Mar 2018 19:51:32 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ez6FH-0005HI-W7 for pgsql-hackers@lists.postgresql.org; Thu, 22 Mar 2018 19:51:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ez6FF-0005Di-Fl for pgsql-hackers@postgresql.org; Thu, 22 Mar 2018 19:51:30 +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 w2MJpPxp017045; Thu, 22 Mar 2018 15:51:25 -0400 From: Tom Lane To: Tomas Vondra cc: David Steele , Stephen Frost , Michael Paquier , Haribabu Kommi , "pgsql-hackers@postgresql.org" Subject: Re: [HACKERS] VACUUM and ANALYZE disagreeing on what reltuples means In-reply-to: <14503.1521739732@sss.pgh.pa.us> References: <16db4468-edfa-830a-f921-39a50498e77e@2ndquadrant.com> <19990.1500936945@sss.pgh.pa.us> <3d250597-384e-c5f4-7533-b513e366888f@2ndquadrant.com> <94f58897-861b-accf-a9f1-af4be816c0d3@2ndquadrant.com> <13097.1509650125@sss.pgh.pa.us> <3dca6a76-fa4b-66ab-c0db-496335d650b1@2ndquadrant.com> <20180105042528.GK2416@tamriel.snowman.net> <1e831867-c46c-8f21-79d4-5de70cac5822@2ndquadrant.com> <13711.1515440364@sss.pgh.pa.us> <01387f5d-a95b-d159-becb-cf9ff9ba4e41@2ndquadrant.com> <8b29edcb-cbc0-5414-996f-520f75b94d3b@2ndquadrant.com> <3b3d8eac-c709-0d25-088e-b98339a1b28a@2ndquadrant.com> <14503.1521739732@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 22 Mar 2018 13:28:52 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17043.1521748285.1@sss.pgh.pa.us> Date: Thu, 22 Mar 2018 15:51:25 -0400 Message-ID: <17044.1521748285@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Tomas Vondra writes: >> The 0002 part is the main part, unifying the definition of reltuples on >> three main places: > On to this part ... I've pushed 0002 with several corrections: it did not seem to me that you'd correctly propagated what ANALYZE is doing into CREATE INDEX or pgstattuple. Also, since one of the things VACUUM does with num_tuples is to report it as "the total number of non-removable tuples", I thought we'd better leave that calculation alone. I made the added code count live tuples in a new variable live_tuples, instead. regards, tom lane