pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Vijaykumar Jain <vjain@opentable.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: [External] Re: xmin and very high number of concurrent transactions
Date: Tue, 12 Mar 2019 14:04:47 -0700
Message-ID: <8e6b18ef-6a58-548f-69ae-da1a1de5539c@aklaver.com> (raw)
In-Reply-To: <CAE7uO5jJkKAb7JhEj7+J+peXHqG94TLMdFFm2Sd3QEDmCwbMgA@mail.gmail.com>
References: <CAE7uO5hEyOdCGw02j6JqJzZAje2b20kzFco9h3Lwia3ahfivtw@mail.gmail.com>
	<2f281edd-5a4e-c429-8e73-67b4a811baa7@aklaver.com>
	<CAE7uO5jJkKAb7JhEj7+J+peXHqG94TLMdFFm2Sd3QEDmCwbMgA@mail.gmail.com>

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 <adrian.klaver@aklaver.com> 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




view thread (8+ messages)  latest in thread

Message-ID: <8e6b18ef-6a58-548f-69ae-da1a1de5539c@aklaver.com>
Permalink:  ../8e6b18ef-6a58-548f-69ae-da1a1de5539c@aklaver.com/
Also on:    postgresql.org/message-id/8e6b18ef-6a58-548f-69ae-da1a1de5539c@aklaver.com

 · 

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: adrian.klaver@aklaver.com, vjain@opentable.com
  Subject: Re: [External] Re: xmin and very high number of concurrent transactions
  In-Reply-To: <8e6b18ef-6a58-548f-69ae-da1a1de5539c@aklaver.com>
  References: <CAE7uO5hEyOdCGw02j6JqJzZAje2b20kzFco9h3Lwia3ahfivtw@mail.gmail.com> <2f281edd-5a4e-c429-8e73-67b4a811baa7@aklaver.com> <CAE7uO5jJkKAb7JhEj7+J+peXHqG94TLMdFFm2Sd3QEDmCwbMgA@mail.gmail.com> <8e6b18ef-6a58-548f-69ae-da1a1de5539c@aklaver.com>

* 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