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 1h3oa2-0003Dy-7P for pgsql-general@arkaria.postgresql.org; Tue, 12 Mar 2019 21:04:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3oa0-0004OD-UM for pgsql-general@arkaria.postgresql.org; Tue, 12 Mar 2019 21:04:56 +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 1h3oZz-0004O6-0c for pgsql-general@lists.postgresql.org; Tue, 12 Mar 2019 21:04:56 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3oZv-0003Lb-By for pgsql-general@lists.postgresql.org; Tue, 12 Mar 2019 21:04:53 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 71EFC3722; Tue, 12 Mar 2019 17:04:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 12 Mar 2019 17:04:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=q fxGhCP2Ux/QIaTKDjxkMfhdKeH4iXT65uSl2YxDjeQ=; b=HLBt4NIT93bqQuUdz s+/mC7wEAUlqjfgpagb5Alnpj6uzEQVE2pxIxYCwSaCuxM+XDH3tPScSkXje5M4D R6cTbzwEFNoMnsUNc3dr0zVV0zaDzjgqwUnX0Y7gtVLAUs/xeU3O3vMs8UpiyNok lAP4hnq6xoFTYPNiIwFcd+dq4pez2Sn+OBdPZrrgFU+lTMGbM30xEx3zEw1aqYlG vwITcLfyUAmvSHC6iEd0aJS9t3HCSYJgdHT6qx+HFc97S/gu+/esu+XktxuQFRnF t/kb3bQiaqM354gX5jkjBHyNepPbyKLtrEeb8wgYbPGD9rVvl52vHreuyLk1FuKB 6c6uw== 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:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=qfxGhCP2Ux/QIaTKDjxkMfhdKeH4iXT65uSl2YxDj eQ=; b=2XoKTnE99WXeWVIQzMwRgYFgV/ZXJLlteh4qdfeqeqyCYYIr72inFotFp hFQx9sTivzyMT3bDGIGIIt2WB2BaRFbYn2frIYMAyj+m35LJNAhLYWEfAjDdbF1G LMAn7VF4FE1Z1PRXxDI/RSvUolsAC/HkUN5E3ecfHXDVicS9SH1w6H/BeXjIeGv7 DqCC66UNY8BgyVFYR27NbJjalzN0MXuaVfYkX4JWilcKE5TMhm34AjsLUE+beAiY w9MqM/JAOQx+W8wWLCfgWGOkR6rZb1bWcGIDahAxzeT33QRpV3dbIkMjXQF9v5V7 drqvC52VD/FSzjET+jtn5IvF0sKAw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrgeekgddugeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeehtddrudel jedrkedtrddvnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ranger.suse (50-197-80-2-static.hfc.comcastbusiness.net [50.197.80.2]) by mail.messagingengine.com (Postfix) with ESMTPA id 52F4310336; Tue, 12 Mar 2019 17:04:48 -0400 (EDT) Subject: Re: [External] Re: xmin and very high number of concurrent transactions To: Vijaykumar Jain Cc: pgsql-general@lists.postgresql.org References: <2f281edd-5a4e-c429-8e73-67b4a811baa7@aklaver.com> From: Adrian Klaver Message-ID: <8e6b18ef-6a58-548f-69ae-da1a1de5539c@aklaver.com> Date: Tue, 12 Mar 2019 14:04:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/12/19 1:02 PM, Vijaykumar Jain wrote: > no i mean not we end users, postgres does it (?) via the xmin and xmax > fields from inherited tables :) if that is what you wanted in a why > or are you asking, does postgres even update those rows and i am wrong > assuming it that way? Not sure where the inherited tables come in? See below for more info: https://www.postgresql.org/docs/11/storage-page-layout.html AFAIK xmin and xmax are just done as part of the insert or delete operations so there is no updating involved. I would say the impact to performance would come from the overhead of each connection rather then maintaining xmin/xmax. > > since the values need to be atomic, > consider the below analogy > assuming i(postgres) am person giving out token to > people(connections/tx) in a queue. > if there is a single line, (sequential) then it is easy for me to > simply give them 1 token incrementing the value and so on. > but if there are thousands of users in parallel lines, i am only one > person delivering the token, will operate sequentially, and the other > person is "blocked" for sometime before it gets the token with the > required value. > so if there are 1000s or users with the "delay" may impact my > performance coz i need to maintain the value of the token to be able > to know what token value i need to give to next person? > > i do not know if am explaining it correctly, pardon my analogy, > > > Regards, > Vijay > > On Wed, Mar 13, 2019 at 1:10 AM Adrian Klaver wrote: >> >> On 3/12/19 12:19 PM, Vijaykumar Jain wrote: >>> I was asked this question in one of my demos, and it was interesting one. >>> >>> we update xmin for new inserts with the current txid. >> >> Why? >> >>> now in a very high concurrent scenario where there are more than 2000 >>> concurrent users trying to insert new data, >>> will updating xmin value be a bottleneck? >>> >>> i know we should use pooling solutions to reduce concurrent >>> connections but given we have enough resources to take care of >>> spawning a new process for a new connection, >>> >>> Regards, >>> Vijay >>> >>> >> >> >> -- >> Adrian Klaver >> adrian.klaver@aklaver.com -- Adrian Klaver adrian.klaver@aklaver.com