pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Kevin Grittner <kgrittn@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Kevin Grittner <kgrittn@postgresql.org>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: pgsql-committers@postgresql.org <pgsql-committers@postgresql.org>
Subject: Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Date: Wed, 20 Apr 2016 07:09:00 -0700
Message-ID: <20160420140900.srcy57hfmumjswqy@alap3.anarazel.de> (raw)
In-Reply-To: <CAA4eK1JihZepuTasniqrHcsha0umwjeke_ay3AckpGMH4QdJ_g@mail.gmail.com>
References: <CACjxUsP=RaV1ue3ccbq4bA0LbN3e7cJJHYj_MCZr1XTKWAZzAQ@mail.gmail.com>
	<20160413171955.i53me46fqqhdlztq@alap3.anarazel.de>
	<CA+Tgmoako8yQh5HE8qK04_oCBkY3C-AncPkSjaVJvWoOuSqzuA@mail.gmail.com>
	<CACjxUsNvVsjJiFy=d2jXZYpo8Evq89YHVjFnLRv5fTF2F5OWPA@mail.gmail.com>
	<20160413192110.fogwesjti3kxycnu@alap3.anarazel.de>
	<20160413200148.bawmwjdmggbllhha@alap3.anarazel.de>
	<CACjxUsMMsSDQTDjdzKY9TwaurN_gNS3Du3kpE5zU5w_AagRmjw@mail.gmail.com>
	<20160416204452.GA1910190@tornado.leadboat.com>
	<20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de>
	<CAA4eK1JihZepuTasniqrHcsha0umwjeke_ay3AckpGMH4QdJ_g@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

On 2016-04-19 20:27:31 +0530, Amit Kapila wrote:
> On Sun, Apr 17, 2016 at 2:26 AM, Andres Freund <andres@anarazel.de> wrote:
> >
> > On 2016-04-16 16:44:52 -0400, Noah Misch wrote:
> > > That is more controversial than the potential ~2% regression for
> > > old_snapshot_threshold=-1.  Alvaro[2] and Robert[3] are okay releasing
> > > that way, and Andres[4] is not.
> >
> > FWIW, I could be kinda convinced that it's temporarily ok, if there'd be
> > a clear proposal on the table how to solve the scalability issue around
> > MaintainOldSnapshotTimeMapping().
> >
> 
> It seems that for read-only workloads, MaintainOldSnapshotTimeMapping()
> takes EXCLUSIVE LWLock which seems to be a probable reason for a
> performance regression.

Yes, that's the major problem.


> Now, here the question is do we need to acquire that lock if xmin is
> not changed since the last time value of
> oldSnapshotControl->latest_xmin is updated or xmin is lesser than
> equal to oldSnapshotControl->latest_xmin?  If we don't need it for
> above cases, I think it can address the performance regression to a
> good degree for read-only workloads when the feature is enabled.

I think the more fundamental issue is that the time->xid mapping is
built at GetSnapshotData() time (via MaintainOldSnapshotTimeMapping()),
and not when xids are assigned. Snapshots are created a lot more
frequently in nearly all use-cases than xids are assigned.  That's what
forces the exclusive lock to be in the read path, rather than the write
path.

What's the reason for this?

Greetings,

Andres Freund


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



view thread (195+ messages)  latest in thread

Message-ID: <20160420140900.srcy57hfmumjswqy@alap3.anarazel.de>
Permalink:  ../20160420140900.srcy57hfmumjswqy@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20160420140900.srcy57hfmumjswqy@alap3.anarazel.de

 · 

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-committers@postgresql.org
  Cc: andres@anarazel.de, amit.kapila16@gmail.com, noah@leadboat.com, kgrittn@gmail.com, robertmhaas@gmail.com, kgrittn@postgresql.org, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
  In-Reply-To: <20160420140900.srcy57hfmumjswqy@alap3.anarazel.de>
  References: <CACjxUsP=RaV1ue3ccbq4bA0LbN3e7cJJHYj_MCZr1XTKWAZzAQ@mail.gmail.com> <20160413171955.i53me46fqqhdlztq@alap3.anarazel.de> <CA+Tgmoako8yQh5HE8qK04_oCBkY3C-AncPkSjaVJvWoOuSqzuA@mail.gmail.com> <CACjxUsNvVsjJiFy=d2jXZYpo8Evq89YHVjFnLRv5fTF2F5OWPA@mail.gmail.com> <20160413192110.fogwesjti3kxycnu@alap3.anarazel.de> <20160413200148.bawmwjdmggbllhha@alap3.anarazel.de> <CACjxUsMMsSDQTDjdzKY9TwaurN_gNS3Du3kpE5zU5w_AagRmjw@mail.gmail.com> <20160416204452.GA1910190@tornado.leadboat.com> <20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de> <CAA4eK1JihZepuTasniqrHcsha0umwjeke_ay3AckpGMH4QdJ_g@mail.gmail.com> <20160420140900.srcy57hfmumjswqy@alap3.anarazel.de>

* 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