Re: Unique constraints for non-btree indexes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Unique constraints for non-btree indexes
Дата
Msg-id 2984.1137619090@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Unique constraints for non-btree indexes  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Unique constraints for non-btree indexes  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Unique constraints for non-btree indexes  (Greg Stark <gsstark@mit.edu>)
Список pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> I guess what you're talking about is a constrained index, of which a
> unique index is just a particular type. I suppose the actual constraint
> would be one of the operators defined for the operator class (since
> whatever the test is, it needs to be indexable). Although some would
> obviously be more useful than others...

I think the generalization that would be appropriate for GIST is that
a "unique" index guarantees there are no two entries x, y such that
x ~ y, where ~ is some boolean operator nominated by the opclass.  We'd
probably have to insist that ~ is commutative (x ~ y iff y ~ x).

Concurrent insertion into a unique GIST index seems a bit nasty.  In
btree we can identify a unique page to lock for any given key value
to ensure that no one else is concurrently inserting a conflicting
key, thus usually allowing concurrent insertions of different keys.
But I don't see how you do that for an arbitrary ~ operator.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unique constraints for non-btree indexes
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Unique constraints for non-btree indexes