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 1shX7u-003XVv-2Y for pgsql-general@arkaria.postgresql.org; Fri, 23 Aug 2024 16:27:02 +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 1shX7s-00Esq3-7B for pgsql-general@arkaria.postgresql.org; Fri, 23 Aug 2024 16:27:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1shX7q-00Espt-MK for pgsql-general@lists.postgresql.org; Fri, 23 Aug 2024 16:27:00 +0000 Received: from fout4-smtp.messagingengine.com ([103.168.172.147]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1shX7m-0018hH-3K for pgsql-general@lists.postgresql.org; Fri, 23 Aug 2024 16:26:58 +0000 Received: from phl-compute-01.internal (phl-compute-01.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id BBDA61385846; Fri, 23 Aug 2024 12:26:52 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Fri, 23 Aug 2024 12:26:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= 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=1724430412; x=1724516812; bh=mzTiIlsfMK5x/cTAKLP1bBR12svRmAeJiaE+a+jBla4=; b= laXz0V2U7J+vcUgRHWMH3oE/zIxVe85da8xngsCitVQHhiMa3uOTX0lCx09o03Dx 0aCQ+qnvc6Gw3InnXDkp0eZG4uCKty2U7xztld/wnEHuIBruIspEOWZYmXWLw21V dHL97Fyj5YOyujZQXF4CvICzY6PfOM6OQv0tqOhjmj1RZ/Vs2lt3Ni9N3G6zpNJI YAauQqkkc/aA/tYYMuFQHHLeX4whBj0aqFgK9dlkJIgWKuYOlsTSOSxKRw3zGQdo osBePVriFtryjwNoKy24djGeQruvrBRetWtLheU/CJ5izB1Xr5DOulyGu3sSCNCY 8cSHTNmIT9c/XiAO9esyNQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=1724430412; x= 1724516812; bh=mzTiIlsfMK5x/cTAKLP1bBR12svRmAeJiaE+a+jBla4=; b=a vIBuRHlupXAblJW+5VBq0gPEaEcx3p2qV5+bZWZxBgWncncue+yaBZK+mCXYz3Fd 9/fyDx7E/rlacXGdmPwgPitSTlRCTjRl85O9Vr84IREd/7W0AAMGmOQEsL3XMWhJ OnxDZQo5wF9E11N/XASuU4bkGuOdl9oCywSZCBZPG1QA//Y3oKumt+NxmEZcXwhE hY0/Y3jI1+xHIDPNQVBWRAL56DZc1rzYGkrYKF1Y31dkZWtu4jrjj73SNwmzq+59 N2x++yobqK4zVgdsMkrhOKa7yXnSN+9GC2682eEE9VItYNhFIghZ6vAeBx1b4rhy xxYPV5KaneECSxm50W1hQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddvvddguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepheekgffgjeefgfetfeev geelvdejteefhfetueevhfduueelveeftdegieeugfffnecuffhomhgrihhnpehpohhsth hgrhgvshhqlhdrohhrghdpghhoohhglhgvrdgtohhmnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklh grvhgvrhdrtghomhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhr tghpthhtohepmhhjthhitggvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlh dqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 23 Aug 2024 12:26:52 -0400 (EDT) Message-ID: <19c4824f-24b8-4561-81c3-a2f4a7949803@aklaver.com> Date: Fri, 23 Aug 2024 09:26:51 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: dead tuple difference between pgstattuple and pg_stat_user_tables To: Matthew Tice , pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/23/24 09:14, Matthew Tice wrote: > Hi All, > > I'm trying to understand why there's a difference between what > pgstattuple reports and pg_stat_user_tables reports (for the number of > dead tuples). > > As I understand, pgstattuple and pgstattuple_approx return the exact > number of dead tuples (as noted in the documentation) and based on an 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? > This is a Google Alloy DB instance running: https://cloud.google.com/alloydb/docs/overview "AlloyDB for PostgreSQL is a fully managed, PostgreSQL-compatible database service that's designed for your most demanding workloads, including hybrid transactional and analytical processing. AlloyDB pairs a Google-built database engine with a cloud-based, multi-node architecture to deliver enterprise-grade performance, reliability, and availability." Where the important parts are 'PostgreSQL-compatible' and 'Google-built database engine'. You probably need to reach out to Google to see what that means for this situation. > > select version(); > -[ RECORD 1 ]------------------------- > version | PostgreSQL 14.10 on x86_64-pc-linux-gnu, compiled by Debian > clang version 12.0.1, 64-bit > SELECT 1 -- Adrian Klaver adrian.klaver@aklaver.com