Re: Deferrable Unique Constraints

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Deferrable Unique Constraints
Дата
Msg-id 12329.1106800964@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Deferrable Unique Constraints  (Neil Conway <neilc@samurai.com>)
Ответы Re: Deferrable Unique Constraints  (Greg Stark <gsstark@mit.edu>)
Список pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> You could perhaps relax the uniqueness of the index during the
> transaction itself, and keep around some backend-local indication of
> which index entries it have been inserted. Then at transaction-commit
> you'd need to re-check the inserted index entries to verify that they
> are unique.

Yeah, what I've been visualizing is a list of "tentative duplicates" ---
that is, you do the immediate unique check same as now, and if it passes
(which hopefully is most of the time) then you're in the clear.
Otherwise you log the apparent duplicate key value to be rechecked at
commit.

> It would be nice to just keep a pin on the leaf page that we
> inserted into, although we'd need to take care to follow subsequent page
> splits (could we use the existing L & Y techniques to do this?).

I do not believe we can do that without risking deadlocks.  It'll be
safer just to repeat the search for each key value that's of concern.
        regards, tom lane


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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Deferrable Unique Constraints
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Deferrable Unique Constraints