Primary key vs unique index

Поиск
Список
Период
Сортировка
От Voils, Steven M
Тема Primary key vs unique index
Дата
Msg-id 856778F98E4F4B4F896F2B70C8164A3437FA990F2D@EXCHANGE-MBX2.AcuityLightingGroup.com
обсуждение исходный текст
Ответы Re: Primary key vs unique index  (Scott Ribe <scott_ribe@elevated-dev.com>)
Re: Primary key vs unique index  (Scott Marlowe <scott.marlowe@gmail.com>)
Re: Primary key vs unique index  (rverghese <riyav@hotmail.com>)
Список pgsql-general

Is there a fundamental difference between a primary key and a unique index?  Currently we have primary keys on tables that have significant amounts of updates performed on them, as a result the primary key indexes are becoming significantly bloated.  There are other indexes on the tables that also become bloated as a result of this, but these are automatically rebuild periodically by the application (using the concurrently flag) when read usage is expected to be very low. 

 

We don’t want to remove the unique constraint of that the primary key is providing, but the space on disk will continue to grow unbounded so we must do something.  Can we replace the primary key with a unique index that could be rebuilt concurrently, or would this be considered bad design?  The reasoning behind this would be that the unique index could be rebuilt concurrently without taking the application down or exclusively locking the table for an extending period of time.  Are there other advantages to a primary key outside of a uniqueness constraint and an index? 

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

Предыдущее
От: bkwiencien
Дата:
Сообщение: pgwatch by Cybertec
Следующее
От: "tamanna madaan"
Дата:
Сообщение: Re: query stuck at SOCK_wait_for_ready function call