Re: [WIP] Add relminxid column to pg_class

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [WIP] Add relminxid column to pg_class
Date: 2006-04-03 00:31:51
Message-ID: 20060403003150.GA27131@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > I just noticed a problem, which is why I labeled it a WIP: the current
> > implementation turns pg_database.datminxid to InvalidTransactionId when
> > the table that has the minimum relminxid is dropped.
>
> I'd argue that you should do nothing, ie, dropping a table should never
> affect datminxid. The proper interpretation of the pg_database columns
> is that we guarantee that all XID's in the database are *at least* thus-
> and-so, not that the minimum is exact.

Ah-ha, an easier approach. This would mean either:

a) we need to seqscan pg_class each time to discover the minimum

b) we need a partial index on pg_class (relminxid) WHERE relkind = 'r'
to quickly discover the minimum
(Is the bootstrap mode able to create partial indexes?)

We need to do this after each vacuum.

We could arrange things so that autovacuum manages to do it only once
after processing a database instead of once per table, but this could be
fragile if the vacuuming dies partway through.

This reminds me of an unrelated problem. On pgsql-bugs or
pgsql-es-ayuda there was a report recently that autovacuum was dying
because of corrupt data on a database. The problem was that this
prevented vacuuming of all other databases as well, because on the next
autovacuum iteration the same database would be chosen and the same
error would ensue. Probably we should do something about this, so that
autovac is allowed to process other databases before failing again on
the offending database.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Robert Treat 2006-04-03 00:47:04 Re: Suggestion: Which Binary?
Previous Message Tom Lane 2006-04-02 23:16:56 Re: [WIP] Add relminxid column to pg_class