pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Vijaykumar Jain <vjain@opentable.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: xmin and very high number of concurrent transactions
Date: Wed, 13 Mar 2019 09:49:40 +0100
Message-ID: <a7a3fc9d64b2884e2108e39189ec1aa943097b1b.camel@cybertec.at> (raw)
In-Reply-To: <CAE7uO5hEyOdCGw02j6JqJzZAje2b20kzFco9h3Lwia3ahfivtw@mail.gmail.com>
References: <CAE7uO5hEyOdCGw02j6JqJzZAje2b20kzFco9h3Lwia3ahfivtw@mail.gmail.com>

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





view thread (8+ messages)  latest in thread

Message-ID: <a7a3fc9d64b2884e2108e39189ec1aa943097b1b.camel@cybertec.at>
Permalink:  ../a7a3fc9d64b2884e2108e39189ec1aa943097b1b.camel@cybertec.at/
Also on:    postgresql.org/message-id/a7a3fc9d64b2884e2108e39189ec1aa943097b1b.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, vjain@opentable.com
  Subject: Re: xmin and very high number of concurrent transactions
  In-Reply-To: <a7a3fc9d64b2884e2108e39189ec1aa943097b1b.camel@cybertec.at>
  References: <CAE7uO5hEyOdCGw02j6JqJzZAje2b20kzFco9h3Lwia3ahfivtw@mail.gmail.com> <a7a3fc9d64b2884e2108e39189ec1aa943097b1b.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox