Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDrSh-0004sv-Qz for pgsql-general@arkaria.postgresql.org; Fri, 27 Sep 2019 14:43:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDrSf-0003Bx-TS for pgsql-general@arkaria.postgresql.org; Fri, 27 Sep 2019 14:43:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDrSf-0002zS-D9 for pgsql-general@lists.postgresql.org; Fri, 27 Sep 2019 14:43:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iDrSd-0006wj-2I for pgsql-general@postgresql.org; Fri, 27 Sep 2019 14:43:08 +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 x8REh3PH030298; Fri, 27 Sep 2019 10:43:03 -0400 From: Tom Lane To: Luca Ferrari cc: pgsql-general Subject: Re: incoherent dead tuples between pg_stat_user_tables and pgstattuple? In-reply-to: References: <20077.1569592342@sss.pgh.pa.us> Comments: In-reply-to Luca Ferrari message dated "Fri, 27 Sep 2019 16:29:37 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30296.1569595383.1@sss.pgh.pa.us> Date: Fri, 27 Sep 2019 10:43:03 -0400 Message-ID: <30297.1569595383@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Luca Ferrari writes: > On Fri, Sep 27, 2019 at 3:52 PM Tom Lane wrote: >> n_live_tup/n_dead_tup should not be thought to be better than >> approximations. Most operations adjust them only incrementally, >> and messages to the stats collector can get dropped entirely >> under heavy load, causing deltas to go missing. There are >> also race conditions involved in some update scenarios. > Are you suggesting tha autovacuum made free space available so that > pg_stat_user_tables lags behind? Because I don't see last_autovacuum > changing in the mantime. I'm not suggesting any specific scenario, because you haven't presented any evidence as to when those counts became off. I'm just saying that there are plenty of possible mechanisms for them to become so. regards, tom lane