Re: Add PK constraint to a Unique Index via updating system catalogs?

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Add PK constraint to a Unique Index via updating system catalogs?
Дата
Msg-id lafc3k$kri$1@ger.gmane.org
обсуждение исходный текст
Ответ на Add PK constraint to a Unique Index via updating system catalogs?  (CS DBA <cs_dba@consistentstate.com>)
Ответы Re: Add PK constraint to a Unique Index via updating system catalogs?
Список pgsql-general
CS DBA wrote on 06.01.2014 23:30:
> We have a few very large tables with unique indexes on a column but
> the column is not defined as the Primary Key.  Can we add a PK
> constraint via updates to the system catalogs so we can avoid the
> lengthy checks that would take place if we ran "alter table add
> constraint primary key...."
>

You can add a PK constraint with the "USING INDEX" clause:

alter table foo
    add primary key
    using index unique_index_name;



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

Предыдущее
От: CS DBA
Дата:
Сообщение: Add PK constraint to a Unique Index via updating system catalogs?
Следующее
От: "Anand Kumar, Karthik"
Дата:
Сообщение: Sudden slow down and spike in system CPU causes max_connections to get exhausted