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 1h3zaN-0001mE-KC for pgsql-general@arkaria.postgresql.org; Wed, 13 Mar 2019 08:50:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3zaM-0006Zk-78 for pgsql-general@arkaria.postgresql.org; Wed, 13 Mar 2019 08:50:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3zaL-0006ZR-Tq for pgsql-general@lists.postgresql.org; Wed, 13 Mar 2019 08:50:01 +0000 Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3zaH-0001Qg-Vl for pgsql-general@lists.postgresql.org; Wed, 13 Mar 2019 08:49:59 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 519AD4C276; Wed, 13 Mar 2019 09:49:54 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id DkZVJfOzusOS; Wed, 13 Mar 2019 09:49:41 +0100 (CET) Message-ID: Subject: Re: xmin and very high number of concurrent transactions From: Laurenz Albe To: Vijaykumar Jain , pgsql-general@lists.postgresql.org Date: Wed, 13 Mar 2019 09:49:40 +0100 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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. > 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, You can read the function GetNewTransactionId in src/backend/access/transam/varsup.c for details. Transaction ID creation is serialized with a "light-weight lock", so it could potentially be a bottleneck. Often that is dwarfed by the I/O requirements from many concurrent commits, but if most of your transactions are rolled back or you use "synchronous_commit = off", I can imagine that it could matter. It is not a matter of how many clients there are, but of how often a new writing transaction is started. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com