Re: Min Xid problem proposal

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Min Xid problem proposal
Date: 2005-12-10 12:23:02
Message-ID: 1134217382.26373.19.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2005-12-09 at 12:32 -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > My proposal to solve that problem, is to make any transaction that
> > inserts or modifies tuples in a table that is marked as frozen, unfreeze
> > it first. The problem I had last time was finding a good spot in the
> > code for doing so. I'm now proposing to do it in the parser, in
> > setTargetTable().
>
> My god, no. Do you have any idea how many paths for updates you've missed?
> (Think about prepared plans for starters.)
>
> Furthermore, you can't do this in the way you propose (non-WAL-logged
> update to pg_class). What if the system crashes without ever having
> written this update to disk? The inserted tuples might have made it ---
> whether they're committed or not doesn't matter, you've still blown it.
>
> I don't see any very good argument for allowing this mechanism to set
> minxid = FrozenXid in the first place. If there are only frozenXid in
> the table, set minxid = current XID. That eliminates the entire problem
> at a stroke.
>
> (Yes, I know what you are going to say. The idea of freezing a table
> and then never having to vacuum it at all is NOT worth the cost of
> putting in a mechanism that would guarantee its safety.)

>From what's been said VACUUM FREEZE will not alter the fact that a
frozen table will need vacuuming again in the future and so cannot ever
be read-only. I can't really see any reason to run VACUUM FREEZE...

If you want to make a table read-only forever, we need a separate
command to do that, ISTM.

ALTER TABLE ... READONLY
could set minXid = FrozenTransactionId, indicating no further VACUUMs
required, ever. We can then disallow INSERT/UPDATE/DELETE against the
table in the permissions layer.

Best Regards, Simon Riggs

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-12-10 12:27:59 Re: Log of CREATE USER statement
Previous Message Markus Schiltknecht 2005-12-10 10:26:16 Re: Replication on the backend