Re: advancing snapshot's xmin

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dimitri Fontaine <dfontaine@hi-media.com>
Cc: pgsql-hackers@postgresql.org, "Heikki Linnakangas" <heikki@enterprisedb.com>, "Neil Conway" <neilc@samurai.com>, "Alvaro Herrera" <alvherre@commandprompt.com>
Date: 2008-03-26T14:18:02Z
Lists: pgsql-hackers
Dimitri Fontaine <dfontaine@hi-media.com> writes:
> Le mercredi 26 mars 2008, Tom Lane a crit:
>> whenever the number of active snapshots goes to zero

> Does this ever happen?

Certainly: between any two commands of a non-serializable transaction.

In a serializable transaction the whole thing is a dead issue
anyway, since the original snapshot has to be kept.

There are corner cases involving open cursors where a snapshot
might persist longer, and then the optimization wouldn't apply.

The formulation that Alvaro gave would sometimes be able to
move xmin forward when the simple no-snaps-left rule wouldn't,
such as create cursor A, create cursor B (with a newer snap),
close cursor A.  However I really doubt that scenarios like
this occur often enough to be worth having a much more expensive
snapshot-management mechanism.

			regards, tom lane