Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nucJ9-0005ET-3o for pgsql-hackers@arkaria.postgresql.org; Fri, 27 May 2022 15:55:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nucJ6-0003uu-I5 for pgsql-hackers@arkaria.postgresql.org; Fri, 27 May 2022 15:55:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nucJ4-0003ul-PU for pgsql-hackers@lists.postgresql.org; Fri, 27 May 2022 15:55:20 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nucIw-0005HN-21 for pgsql-hackers@postgresql.org; Fri, 27 May 2022 15:55:17 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id CE9D33200923; Fri, 27 May 2022 11:55:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 27 May 2022 11:55:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1653666905; x=1653753305; bh=S2JPcw4+jf J/yKK5ij4ZkXaL4jEh1zD+g/3Ir7fLO2s=; b=m3ku24JE9pwxz7sgp6AAr+92eF hD4k3UqFm8dps4MCQFc4bkAOY4uxCrY+nATOHI5nESYzrGMAxOl8X3KLj3ujYp5L q1qZ7W9gYdHB4BTfSlgJUylZY8NcV89GH0nSulRml3JdYjaFUpNz+gI9WATWPfPa 4gS/gIQ36v+ht7KvuT0B+bmn9kaRoE1Bv5o/INmrUHOcWrXwHKI81RB/wPegReca KaeWVO6RziyBJ5hF0QMx0WKzQ+DSUbWQ0pheEFnQz0R5r9MnGBWrI2q4g1T/ksnd C2jqGrzIuPlYPrkiCcOq+zcGMoLum0fql1Mu4gKIMwJwzGkQ7+JXYaOUV7sA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1653666905; x=1653753305; bh=S2JPcw4+jfJ/yKK5ij4ZkXaL4jEh 1zD+g/3Ir7fLO2s=; b=AjwpXwC87F7C3sgdS0f3756tbpekrstPG/6vSpEqt7cX /lcruRI+d636WqVYJr8ckLf1cFiVLUyIsbLPE3ENQ4yLJ4nm8ERzj79cotB3NCsB 093XXZgQ6Dm0fhkbuzAk2jvMrfFpg2i5hIrBr6PBgOHJJnd7DHZTH76JbkC6zBxS ELgzXKdxJczb16hi2lAfzcRuGM4GrdR72ynah9bycdSfgA2+j4KtftA8s4FogbtY 4lGrJKJxUHOoA9342mglH0UxSg+KIRzpGYJtO3PgFYTI19tZAIfJUhX3qp5qUor5 Yt7/ljy4n3WdVDW6bPapriYb0bl8kEolCSNeBYWixg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrjeelgdelhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdefhedmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddt vdenucfhrhhomheptehnughrvghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrg iivghlrdguvgeqnecuggftrfgrthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdff jeevhfeuteegleduheetveduieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 27 May 2022 11:55:04 -0400 (EDT) Date: Fri, 27 May 2022 08:55:02 -0700 From: Andres Freund To: Amit Kapila Cc: Michael Paquier , Julien Rouhaud , Simon Riggs , Andrey Borodin , Pengchengliu , PostgreSQL Hackers Subject: Re: suboverflowed subtransactions concurrency performance optimize Message-ID: <20220527155502.gpja3roizggvbgeh@alap3.anarazel.de> References: <20220307094855.kkc6vagshyc6xsbn@jrouhaud> <20220307141741.6jidhra3tup6uiaf@jrouhaud> <20220524235250.gtt3uu5zktfkr4hv@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-05-27 15:44:39 +0530, Amit Kapila wrote: > On Thu, May 26, 2022 at 12:53 PM Michael Paquier wrote: > > > > On Tue, May 24, 2022 at 04:52:50PM -0700, Andres Freund wrote: > > > > > 2) xid wraparound. There's nothing forcing SubTransGetTopmostTransaction() to > > > be called regularly, so even if a backend isn't idle, the cache could just > > > get more and more outdated until hitting wraparound > > > > Hence, you mean that the non-regularity of the call makes it more > > exposed to an inconsistent result after a wraparound? > > > > Won't in theory the similar cache in transam.c is also prone to > similar behavior? It's not quite the same risk, because there we are likely to actually hit the cache regularly. Whereas quite normal workloads might not hit this cache for days on end. > Anyway, how about if we clear this cache for subtrans whenever > TransactionXmin is advanced and cachedFetchSubXid precedes it? The > comments atop SubTransGetTopmostTransaction seem to state that we > don't care about the exact topmost parent when the intermediate one > precedes TransactionXmin. I think it should preserve the optimization > because anyway for such cases there is a fast path in > SubTransGetTopmostTransaction. There's not even a proof this does speed up anything useful! There's not a single benchmark for the patch. Greetings, Andres Freund