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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Catalog Access (was: [GENERAL] Concurrency problem building indexes)
Дата
Msg-id 22715.1145987907@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Catalog Access (was: [GENERAL] Concurrency problem building indexes)  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Catalog Access (was: [GENERAL] Concurrency problem  (Hannu Krosing <hannu@skype.net>)
Список pgsql-hackers
Martijn van Oosterhout <kleptog@svana.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Avoiding redundant fetches of btree index metapages
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: Installation on Duel-Core Pentium XP