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 1hnqb2-0000OA-Nf for pgsql-admin@arkaria.postgresql.org; Wed, 17 Jul 2019 20:32:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hnqb1-0008LU-Cd for pgsql-admin@arkaria.postgresql.org; Wed, 17 Jul 2019 20:32:15 +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 1hnqaz-0008Ac-82 for pgsql-admin@lists.postgresql.org; Wed, 17 Jul 2019 20:32:15 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hnqau-0000UZ-PM for pgsql-admin@lists.postgresql.org; Wed, 17 Jul 2019 20:32:11 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 97B8B21FC5; Wed, 17 Jul 2019 16:32:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 17 Jul 2019 16:32:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=+Kh/DHvkRXXLSFGMXKtdCmyJ5H3 v/mGsYoPhOVm8FD4=; b=qBKwODAfo29d2cfxKK7a/Gn+3qiCKB1CpDzImc/r8YH TL3qHpz9GhYutkUIp8NWQiHbOOu/PpWY2JqQFBx0C3oDg76JDf45qpVAQlLISj5H ZoOPWFBhvzfs29tm1IRcUGFz55r6quacQH32rMIHJMPqikEKlgAPL69dI/F/4umn 0zWI8/u1bOM8ktwaAQQS7v4gcn+MOcsokkybwmolyxbTdV5bSWNhIurklsv3/RaF O50WY8xEepcb+iTJbHa7xnNQ6+xCJeRTJb9F0EfB2GShHmfdb31PwaXplUWLWQLf SXbJohrcbpykvnzmlfyCIF6KzPaASNM/biMb70UWRvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=+Kh/DH vkRXXLSFGMXKtdCmyJ5H3v/mGsYoPhOVm8FD4=; b=1BWYIveQuG8HmIhu/wffrW Ebf0IDJYOOnKXQwfvjiSG0kSKjrJQtbh/D2NTyQyfxQ1twdN6NgtRKEJ5y/r+nFE ywI2xS9fnlnGee5s5LVd7sxBPvDtC5DjI20xhrfN6Lm08DWmo16lgXchIebKuhzz h15hfOkfmeCMPJpazkF9HMRqcywFYTeEpm3PQ1ZGq+mvLTZVZzHw3SUIySj50SDl M/32GfMrxKd745YQl3Hzkm5EeBQgNU1wHP3e6i9utJomVJYaop6b/kVy31SLvlO2 9isySt2OylGcqrH8apBKE8CTNKx/0p4lhFSinbhkTah6/1W3VOMQXpy1S8KBsiGw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrieefgdduvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucfkphepie ejrdduiedtrddvudekrddvfeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgv shesrghnrghrrgiivghlrdguvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-218-237.hsd1.ca.comcast.net [67.160.218.237]) by mail.messagingengine.com (Postfix) with ESMTPA id 7C85280062; Wed, 17 Jul 2019 16:32:06 -0400 (EDT) Date: Wed, 17 Jul 2019 13:32:04 -0700 From: Andres Freund To: "S. Bob" Cc: pgsql-admin@lists.postgresql.org Subject: Re: xmin value from pg_stat_replication Message-ID: <20190717203204.iteonyhzrtp2alxx@alap3.anarazel.de> References: <2bbb14f7-b894-cf98-986f-59e4711d0aa5@quadratum-braccas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2bbb14f7-b894-cf98-986f-59e4711d0aa5@quadratum-braccas.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-07-17 12:31:29 -0600, S. Bob wrote: > We have a master and a standby (Streaming replication). > > This query produces a value of approx 1.5million on the master and approx > 80million on the standby: > > > select slot_name, slot_type, database, xmin from pg_replication_slots order > by age(xmin); I'd suggest using age(xmin) in the output as well, not just in the ORDER BY, otherwise it's hard to make sense of the value. When you say a value of '1.5 million' on the master, how did you determine that? Because the above doesn't return anything for the master. The simplest way to determine that is probably: SELECT max(age(backend_xmin)) FROM pg_stat_activity; When you say '80 million', do you mean that pg_replication_slots.xmin was 80 million, or age(pg_replication_slots.xmin)? If it's the former, then that would indicate that the standby is *not* a problem, but that you have a long-running transaction or such on the primary. Basically, age(xmin) has to be large, not xmin itself. > We are running replication in async mode. > > > A couple of questions: > > > - Is it unusual for the master & standby to differ dramatically like this? Do you have very longrunning queries on the standby or primary? That's typically the reason why xmin is old. > - could the replication slot (i.e. the xmin on the standby) be preventing > vacuum from cleaning up row versions on the master? Yes. Greetings, Andres Freund