Re: why do we need two snapshots per query? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: why do we need two snapshots per query?
Date
Msg-id 6344.1321200592@sss.pgh.pa.us
Whole thread Raw
In response to Re: why do we need two snapshots per query?  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: why do we need two snapshots per query?
Re: why do we need two snapshots per query?
List pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> If we could be certain that a query was being executed immediately

... that is, with the same snapshot ...

> then it would be possible to simplify expressions using stable
> functions as if they were constants. My earlier patch did exactly
> that.

Mph.  I had forgotten about that aspect of it.  I think that it's
very largely superseded by Marti Raudsepp's pending patch:
https://commitfest.postgresql.org/action/patch_view?id=649
which does more and doesn't require any assumption that plan and
execution snapshots are the same.

Now you're going to say that that doesn't help for failure to prove
partial index or constraint conditions involving stable functions,
and my answer is going to be that that isn't an interesting use-case.
Partial index conditions *must* be immutable, and constraint conditions
*should* be.  As far as partitioning goes, the correct solution there
is to move the partition selection to run-time, so we should not be
contorting query semantics to make incremental performance improvements
with the existing partitioning infrastructure.

I remain of the opinion that Robert's proposal is a bad idea.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Detach/attach database
Next
From: Tom Lane
Date:
Subject: Re: SQLDA fix for ECPG