Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1shXYd-003cC7-Mq for pgsql-general@arkaria.postgresql.org; Fri, 23 Aug 2024 16:54:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1shXXd-00FAvL-Kh for pgsql-general@arkaria.postgresql.org; Fri, 23 Aug 2024 16:53:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1shXXd-00FAuo-9y for pgsql-general@lists.postgresql.org; Fri, 23 Aug 2024 16:53:37 +0000 Received: from fhigh7-smtp.messagingengine.com ([103.168.172.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1shXXb-0015bO-6D for pgsql-general@lists.postgresql.org; Fri, 23 Aug 2024 16:53:36 +0000 Received: from phl-compute-02.internal (phl-compute-02.nyi.internal [10.202.2.42]) by mailfhigh.nyi.internal (Postfix) with ESMTP id B57811151B66; Fri, 23 Aug 2024 12:53:16 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Fri, 23 Aug 2024 12:53:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1724431996; x=1724518396; bh=gJndJ42sKUzsxV2hi4YT7KHKO6tXIt8vVutNbLTF6mk=; b= yGcvmWzOaP/resVlF0pZB3SJuLygXmmbhQ9sypq3MoOREthldRtfHJXarcPDWoJn gUc3dVwGEuNHzMXVo6FYbgCQgrMVwRq+tVRXxDm0nX0CgjDTWFdSCNtU+WozKTZc 36RlK8qxBGmp6Ju9y8f+4ZH0LSpte7dhzQnmlzcehQyi3leW5SFpOGRmAoYTLAu6 s6+j7xv0udazXhnxTiNnXyQhiU7QfMMOYHGPMrqTD2m2FWAFahVWYk9MsSFyVG0r qZ8YIaABh3A7eV9zQTi29/RLi2tqV4SXhu+QO8rNoWskJBv2mhhJJ9nRxXUkhe26 xYEGCcFm9M8HuP4yHW84QA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1724431996; x= 1724518396; bh=gJndJ42sKUzsxV2hi4YT7KHKO6tXIt8vVutNbLTF6mk=; b=r oRsFyqNcBrGXYqrmWTMY3AAQfxAMM+r8gDx2fU2ygeRrWeuyzAAQM6x/IhFXKYAd U31KKUIcGprtD9rHgOfEtP+h49P12ABR+F+Udh/kK3UmMz5fRweMINkONBR87/G2 riShvtyIA1Z2A5KkfY2ILixIenc3VGVpstFeq85in6uVFOf6EYFHjP9qi1eNwEQv Q2UKs+yU2srp22DacPnjVCjbZzCblFjQchKOWyDF8ps2RidNzeo8mcCn6hrL5XUG PGp3R1xTtMfi8UyZZkVW8gSpfQ8ai3Q2xE3cQkr0MLmbxorglU/0mIy5hxFCWeDY lLpWqV0tWgzxAl+nGkpDg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddvvddguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuhffvvehfjggtgfesthekredttddv jeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpedvieefffefgfeftdfg jeetteduvdekieevieffgfdvkeevieehfeduvedvjeffffenucffohhmrghinhepphhosh htghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhhjthhi tggvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslh hishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 23 Aug 2024 12:53:15 -0400 (EDT) Message-ID: Date: Fri, 23 Aug 2024 09:53:15 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: dead tuple difference between pgstattuple and pg_stat_user_tables From: Adrian Klaver To: Matthew Tice Cc: pgsql-general@lists.postgresql.org References: <19c4824f-24b8-4561-81c3-a2f4a7949803@aklaver.com> <5f0601fd-7ab9-4b40-9356-43c463223bed@aklaver.com> Content-Language: en-US In-Reply-To: <5f0601fd-7ab9-4b40-9356-43c463223bed@aklaver.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/23/24 09:51, Adrian Klaver wrote: > On 8/23/24 09:33, Matthew Tice wrote: >> >> >> On Fri, Aug 23, 2024 at 10:26 AM Adrian Klaver >> > wrote: > >>     https://www.postgresql.org/docs/current/pgstattuple.html >>     >> >>     pgstattuple_approx(regclass) returns record >> >>           pgstattuple_approx is a faster alternative to pgstattuple that >>     returns approximate results. >> >>     Not sure how you get exact count out of that? >> >> >> Maybe the wording is a little confusing to me. Under the section >> for pgstattuple_approx: >> "pgstattuple_approx tries to avoid the full-table scan and returns >> exact dead tuple statistics along with an approximation of the number >> and size of live tuples and free space." > > Yeah, see what you mean. > > The part that bears more investigating for this case is: > > "It does this by skipping pages that have only visible tuples according > to the visibility map (if a page has the corresponding VM bit set, then > it is assumed to contain no dead tuples). > > Wondering if PostgreSQl-compatible covers this? Meant to add: What happens if you use pgstattuple instead? -- Adrian Klaver adrian.klaver@aklaver.com