Re: Add primary key/unique constraint using prefix columns of an index

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Add primary key/unique constraint using prefix columns of an index
Дата
Msg-id CA+U5nMJRKj0+yuvmSaqWt=hVMeH2=ZLs70dw2MfRQRQex5EK_Q@mail.gmail.com
обсуждение исходный текст
Ответ на Add primary key/unique constraint using prefix columns of an index  (Jeff Janes <jeff.janes@gmail.com>)
Ответы Re: Add primary key/unique constraint using prefix columns of an index  (Vik Reykja <vikreykja@gmail.com>)
Список pgsql-hackers
On 22 May 2012 18:24, Jeff Janes <jeff.janes@gmail.com> wrote:
> Now that there are index only scans, there is a use case for having a
> composite index which has the primary key or a unique key as the
> prefix column(s) but with extra columns after that.  Currently you
> would also need another index with exactly the primary/unique key,
> which seems like a waste of storage and maintenance.
>
> Should there be a way to declare a "unique" index with the unique
> property applying to a prefix of the indexed columns/expression?  And
> having that, a way to turn that prefix into a primary key constraint?
>
> Of course this is easier said then done, but is there some reason for
> it not to be a to-do item?

+1

Very useful

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Changing the concept of a DATABASE
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Add primary key/unique constraint using prefix columns of an index