pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <robertmhaas@gmail.com>
To: Kevin Grittner <kgrittn@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Ants Aasma <ants.aasma@eesti.ee>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Noah Misch <noah@leadboat.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: Tue, 24 May 2016 17:10:51 -0400
Message-ID: <CA+TgmobmG1GxtEzQhnorXnknzbJ_fWvu7Hb5p_Zn6N6jibrkLA@mail.gmail.com> (raw)
In-Reply-To: <CACjxUsN7VNe_q0xGA7xfoTM_yqQXpqOTjhk4CQ479fQthhEFfg@mail.gmail.com>
References: <20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de>
	<CAA4eK1JihZepuTasniqrHcsha0umwjeke_ay3AckpGMH4QdJ_g@mail.gmail.com>
	<171569342.34745.1461078735421@RIA>
	<CA+CSw_tqckBCfrTgMyQOBGscM=5t7qYzBS94udGUOFWiOLeHbw@mail.gmail.com>
	<CACjxUsNO=fwsug6yWUcbt=SW5ZjGBqA35ToWgN8LMoAMMMaS3A@mail.gmail.com>
	<20160506220728.bgyxet73t6s3hjiw@alap3.anarazel.de>
	<CACjxUsNmsE-c+NzDbeEX82najPs4CdhPm9MpDep1-VeEUXwegw@mail.gmail.com>
	<20160507004844.wbze4nhjqa67io2a@alap3.anarazel.de>
	<CACjxUsOwwoCsyrspbCviuYCW7zvBviHpTMLXTHY5zzD-F=CHMQ@mail.gmail.com>
	<CACjxUsNs5eomM0v_0PQ9kz3CbfGEBg4H_Bh-fT4nwcyw0jdJSQ@mail.gmail.com>
	<20160524170058.6fhenruilde4xza4@alap3.anarazel.de>
	<CACjxUsN7VNe_q0xGA7xfoTM_yqQXpqOTjhk4CQ479fQthhEFfg@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

On Tue, May 24, 2016 at 3:48 PM, Kevin Grittner <kgrittn@gmail.com> wrote:
> On Tue, May 24, 2016 at 12:00 PM, Andres Freund <andres@anarazel.de> wrote:
>> On 2016-05-24 11:24:44 -0500, Kevin Grittner wrote:
>>> On Fri, May 6, 2016 at 8:28 PM, Kevin Grittner <kgrittn@gmail.com> wrote:
>>>> On Fri, May 6, 2016 at 7:48 PM, Andres Freund <andres@anarazel.de> wrote:
>>>
>>>>> That comment reminds me of a question I had: Did you consider the effect
>>>>> of this patch on analyze? It uses a snapshot, and by memory you've not
>>>>> built in a defense against analyze being cancelled.
>
> The primary defense is not considering a cancellation except in 30
> of the 500 places a page is used.  None of those 30 are, as far as
> I can see (upon review in response to your question), used in the
> analyze process.

It's not obvious to me how this is supposed to work.  If ANALYZE's
snapshot is subject to being ignored for xmin purposes because of
snapshot_too_old, then I would think it would need to consider
cancelling itself if it reads a page with possibly-removed data, just
like in any other case.  It seems that we might not actually need a
snapshot set for ANALYZE in all cases, because the comments say:

                    /* functions in indexes may want a snapshot set */
                    PushActiveSnapshot(GetTransactionSnapshot());

If we can get away with it, it would be a rather large win to only set
a snapshot when the table has an expression index.  For purposes of
"snapshot too old", though, it will be important that a function in an
index which tries to read data from some other table which has been
pruned cancels itself when necessary.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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: <CA+TgmobmG1GxtEzQhnorXnknzbJ_fWvu7Hb5p_Zn6N6jibrkLA@mail.gmail.com>
Permalink:  ../CA+TgmobmG1GxtEzQhnorXnknzbJ_fWvu7Hb5p_Zn6N6jibrkLA@mail.gmail.com/
Also on:    postgresql.org/message-id/CA+TgmobmG1GxtEzQhnorXnknzbJ_fWvu7Hb5p_Zn6N6jibrkLA@mail.gmail.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-committers@postgresql.org
  Cc: robertmhaas@gmail.com, kgrittn@gmail.com, andres@anarazel.de, ants.aasma@eesti.ee, amit.kapila16@gmail.com, noah@leadboat.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: <CA+TgmobmG1GxtEzQhnorXnknzbJ_fWvu7Hb5p_Zn6N6jibrkLA@mail.gmail.com>
  References: <20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de> <CAA4eK1JihZepuTasniqrHcsha0umwjeke_ay3AckpGMH4QdJ_g@mail.gmail.com> <171569342.34745.1461078735421@RIA> <CA+CSw_tqckBCfrTgMyQOBGscM=5t7qYzBS94udGUOFWiOLeHbw@mail.gmail.com> <CACjxUsNO=fwsug6yWUcbt=SW5ZjGBqA35ToWgN8LMoAMMMaS3A@mail.gmail.com> <20160506220728.bgyxet73t6s3hjiw@alap3.anarazel.de> <CACjxUsNmsE-c+NzDbeEX82najPs4CdhPm9MpDep1-VeEUXwegw@mail.gmail.com> <20160507004844.wbze4nhjqa67io2a@alap3.anarazel.de> <CACjxUsOwwoCsyrspbCviuYCW7zvBviHpTMLXTHY5zzD-F=CHMQ@mail.gmail.com> <CACjxUsNs5eomM0v_0PQ9kz3CbfGEBg4H_Bh-fT4nwcyw0jdJSQ@mail.gmail.com> <20160524170058.6fhenruilde4xza4@alap3.anarazel.de> <CACjxUsN7VNe_q0xGA7xfoTM_yqQXpqOTjhk4CQ479fQthhEFfg@mail.gmail.com> <CA+TgmobmG1GxtEzQhnorXnknzbJ_fWvu7Hb5p_Zn6N6jibrkLA@mail.gmail.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