Re: Catalog Access (was: [GENERAL] Concurrency problem building indexes)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>, Wes <wespvp(at)syntegra(dot)com>, Zeugswetter Andreas DCP SD <ZeugswetterA(at)spardat(dot)at>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Catalog Access (was: [GENERAL] Concurrency problem building indexes)
Date: 2006-04-25 17:58:27
Message-ID: 22715.1145987907@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> I think the basic problem is that DDL can't really work within a
> transaction. If I do an ALTER TABLE, some of these changes need to show
> up to concurrent transactions (maybe creating a unique index?).

The point is that DDL can't be MVCC. If for instance you add an index
to a table, once you commit every other transaction must *immediately*
start updating that index when they modify the table. They can't use
the excuse of "not my problem because the catalog change postdates the
snapshot I'm using". The drop-index case is even worse, since a
transaction that believes the index is still present is likely to try
to access/update a disk file that's not there anymore. Adding/dropping
columns, constraints, triggers, etc all have hazards of the same ilk.

> I think it's like Tom says in that email, it could be done, but the
> cost/benefit ratio isn't very good...

It's barely possible that we could make this happen, but it would be a
huge amount of work, and probably a huge amount of instability for a
very long time until we'd gotten all the corner cases sorted. I think
there are much more productive uses for our development effort.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2006-04-25 18:40:13 Re: Installation on Duel-Core Pentium XP
Previous Message Alvaro Herrera 2006-04-25 17:52:53 Re: Avoiding redundant fetches of btree index metapages