pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] getting rid of SnapshotNow
Date: Thu, 18 Jul 2013 10:34:14 -0400
Message-ID: <3461.1374158054@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoaLeu7wKtfPA0v=iQNMKOJZqg4TZf1Gyxn=7mbwa=Mxag@mail.gmail.com>
References: <CA+TgmoaLeu7wKtfPA0v=iQNMKOJZqg4TZf1Gyxn=7mbwa=Mxag@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Robert Haas <robertmhaas@gmail.com> writes:
> 1. snapshot-error-v1.patch introduces a new special snapshot, called
> SnapshotError.  In the cases where we set SnapshotNow as a sort of
> default snapshot, this patch changes the code to use SnapshotError
> instead.  This affects scan->xs_snapshot in genam.c and
> estate->es_snapshot in execUtils.c.  This passes make check-world, so
> apparently there is no code in the core distribution that does this.
> However, this is safer for third-party code, which will ERROR instead
> of seg faulting.  The alternative approach would be to use
> InvalidSnapshot, which I think would be OK too if people dislike this
> approach.

FWIW, I think using InvalidSnapshot would be preferable to introducing
a new concept for what's pretty much the same thing.

> With that done, the only remaining uses of SnapshotNow in our code
> base will be in currtid_byreloid() and currtid_byrelname().  So far no
> one on this list has been able to understand clearly what the purpose
> of those functions is, so I'm copying this email to pgsql-odbc in case
> someone there can provide more insight.

I had the idea they were used for a client-side implementation of WHERE
CURRENT OF.  Perhaps that's dead code and could be removed entirely?

> If we don't want to risk any change to the semantics, we can (1) grit
> our teeth and keep SnapshotNow around or (2) use an instantaneous MVCC
> snapshot there, and accept that people who have very large connection
> counts and extremely heavy use of those functions may see a
> performance regression.

Of those I'd go for (2); it's unlikely that an extra snapshot would be
visible compared to the query roundtrip overhead.  But another attractive
possibility is to make these functions use GetActiveSnapshot(), which
would avoid taking any new snapshot.

			regards, tom lane


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



view thread (44+ messages)  latest in thread

Message-ID: <3461.1374158054@sss.pgh.pa.us>
Permalink:  ../3461.1374158054@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3461.1374158054@sss.pgh.pa.us

 · 

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-odbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: [ODBC] getting rid of SnapshotNow
  In-Reply-To: <3461.1374158054@sss.pgh.pa.us>
  References: <CA+TgmoaLeu7wKtfPA0v=iQNMKOJZqg4TZf1Gyxn=7mbwa=Mxag@mail.gmail.com> <3461.1374158054@sss.pgh.pa.us>

* 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