From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Tomas Vondra <tv@fuzzy.cz>
Cc: Thom Brown <thom@linux.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: change in LOCK behavior
Date: Wed, 10 Oct 2012 22:01:30 -0400
Message-ID: <16581.1349920890@sss.pgh.pa.us> (raw)
In-Reply-To: <20121011013428.GH11890@momjian.us>
References: <5075D8DF.6050500@fuzzy.cz>
<CAA-aLv4PF-gM6mt4ZP4GnKGkZE1fheVeUC=8jQCgzvWbaA8+mQ@mail.gmail.com>
<5075DFC2.9090306@fuzzy.cz>
<12761.1349910622@sss.pgh.pa.us>
<CA+TgmoZjLV2J44-WD5w0VhuXoPzfaY7_p5nTi6y73w9898-vMA@mail.gmail.com>
<14951.1349916214@sss.pgh.pa.us>
<20121011011118.GF11890@momjian.us>
<15934.1349918956@sss.pgh.pa.us>
<20121011013428.GH11890@momjian.us>
Bruce Momjian <bruce@momjian.us> writes:
> On Wed, Oct 10, 2012 at 09:29:16PM -0400, Tom Lane wrote:
>> In what way would somebody be relying on the 9.2 behavior?
> I don't know. I am just asking if an application could be relying on
> the 9.2 behavior.
I don't think so. Robert suggested in the original discussion that
there could be cases where users would notice if the plan snapshot was
different from the execution snapshot, but on reflection I consider that
argument bogus. We have these categories of snapshot-dependent things
that happen before execution starts:
* System examination of table DDL. This is all done with SnapshotNow
and after acquiring a lock on the table, so it's secure.
* Evaluation of the input functions for user-defined types and domains
(the latter of which can invoke nearly arbitrary code via CHECK
constraints). In principle you could imagine that one of these
datatypes or domain check constraints involves looking at the tables
that the surrounding query is going to touch, but I don't think anybody
would consider that good programming style, much less expect that it
would necessarily see exactly the same table state as query execution
does.
* Evaluation of IMMUTABLE functions at plan time. If such a function
actually cares exactly which snapshot it runs with, then it's not very
immutable, and I feel no compunction about breaking it.
* Evaluation of STABLE functions at plan time for estimation purposes.
Such a function might well get different answers depending on which
snapshot it uses --- but the result is only used for estimation
purposes. The worst possible consequence is an inferior plan; there is
no correctness issue.
So it seems to me to be pretty difficult to credit that any of these
things would care at all whether they saw the exact same snapshot that
query execution does. It's even less plausible that somebody would have
created such a dependency in the short time 9.2 has been out, when such
code could not have worked in any prior release.
regards, tom lane
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-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, bruce@momjian.us, robertmhaas@gmail.com, tv@fuzzy.cz, thom@linux.com
Subject: Re: change in LOCK behavior
In-Reply-To: <16581.1349920890@sss.pgh.pa.us>
References: <5075D8DF.6050500@fuzzy.cz> <CAA-aLv4PF-gM6mt4ZP4GnKGkZE1fheVeUC=8jQCgzvWbaA8+mQ@mail.gmail.com> <5075DFC2.9090306@fuzzy.cz> <12761.1349910622@sss.pgh.pa.us> <CA+TgmoZjLV2J44-WD5w0VhuXoPzfaY7_p5nTi6y73w9898-vMA@mail.gmail.com> <14951.1349916214@sss.pgh.pa.us> <20121011011118.GF11890@momjian.us> <15934.1349918956@sss.pgh.pa.us> <20121011013428.GH11890@momjian.us> <16581.1349920890@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