On Wed, Jun 06, 2012 at 03:08:05PM -0400, Robert Haas wrote:
> On Mon, Jun 4, 2012 at 9:26 PM, Jeff Davis <pgsql@j-davis.com> wrote:
> > Thoughts?
>
> Simon already proposed a way of doing this that doesn't require
> explicit user action, which seems preferable to a method that does
> require explicit user action, even though it's a little harder to
> implement. His idea was to store the XID of the process creating the
> table in the pg_class row, which I think is *probably* better than
> your idea of having a process that waits and then flips the flag.
> There are some finicky details though - see previous thread for
> discussion of some of the issues.
I think both improvements have a place. Loads to a new heap should take as
many automatic shortcuts as practical. Loads to an existing heap also matter,
and Jeff's proposal helps those.
> It would be very nice to have a method that detects whether or not
> there is only one open snapshot in a particular backend. Any time
> that condition is met, tuples written into a table created or
> truncated in the current transaction can be written with
> HEAP_XMIN_COMMITTED already set.
Perhaps criteria like those in CheckTableNotInUse() would suffice?