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 1mdEGt-000371-M8 for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Oct 2021 16:16:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mdEGs-0005qz-Ew for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Oct 2021 16:16:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdEGs-0005mq-5s for pgsql-hackers@lists.postgresql.org; Wed, 20 Oct 2021 16:16:54 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdEGp-0004yF-CI for pgsql-hackers@lists.postgresql.org; Wed, 20 Oct 2021 16:16:53 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id A1C525C0293; Wed, 20 Oct 2021 12:16:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 20 Oct 2021 12:16:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=9I4dRsxH0g7LhlDPVa5O1HkYdmN2N0xX9g9gindHnbg=; b=UOMSuNRO iItD594hI2J+0hegCwKFTrieUWSlNK+qsmyKUQ5betxenZ+wn0qy47L+TqBAge92 rhoHoGJ/9i/2qPsEvfh4tDPllV4hG9JIapvggLGcU9XB7Qqey93f90N2Rm4td9ik XHKsghn/Ki7ITNkqDpybtjiZq/17fs75nu3flkCShJSNlur1LKaCT6FyZrI6cMHJ jO/t3hqlm2q047yhXB4jpAPI/PImD7QNUs2vMKByRvdais3ImybDjVmPJrw3aXcz UUG410FjpoBpp+YtyyzrbWwpi5yWvr3cMRmCEiWKVoUv/ADkWXa1B5yRhIMgEAh+ mesVU8Ks0IEnmw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvgedgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedujeevjeffjeevuddutedvkeeiueeitddvieelfeekveej udefgeeuvdejhfeuleenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 20 Oct 2021 12:16:50 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 4AAF52A06EC; Wed, 20 Oct 2021 13:16:47 -0300 (-03) Date: Wed, 20 Oct 2021 13:16:47 -0300 From: Alvaro Herrera To: Dilip Kumar Cc: Amit Kapila , Robert Haas , PostgreSQL Hackers Subject: Re: pgsql: Document XLOG_INCLUDE_XID a little better Message-ID: <202110201616.ftltjk5b2rwv@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Oct-20, Dilip Kumar wrote: > On Wed, Oct 20, 2021 at 7:09 PM Alvaro Herrera wrote: > > In IsTopTransactionIdLogPending(), I suggest to reorder the tests so > > that the faster ones are first -- or at least, the last one should be at > > the top, so in some cases we can return without additional function > > calls. I don't think it'd be extremely noticeable, but as Tom likes to > > say, a cycle shaved is a cycle earned. > > I don't think we can really move the last at top. Basically, we only > want to log the top transaction id if all the above check passes and > the top xid is not yet logged. For example, if the WAL level is not > logical then we don't want to log the top xid even if it is not yet > logged, similarly, if the current transaction is not a subtransaction > then also we don't want to log the top transaction. Well, I don't suggest to move it verbatim, but ISTM the code can be restructured so that we do that test first, and if we see that flag set to true, we don't have to consider any of the other tests. That flag can only be set true if we saw all the other checks pass in the same subtransaction, right? -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/