Re: Foreign keys and slow insert

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Foreign keys and slow insert
Дата
Msg-id 42A719A2.2060804@archonet.com
обсуждение исходный текст
Ответ на Foreign keys and slow insert  (Dan Black <fireworker@gmail.com>)
Список pgsql-general
Dan Black wrote:
> I read in documentation that primary key doesn't require additional indexes
> but I could find nothing about foreign keys.
> Do I need to create additional indexes when I create foreign keys?
> Example:
> create table master

> create table slave

> Do I need to create index
>
> CREATE INDEX my_index
> ON slave
> USING btree
> (master_id);

Yes. The primary key uses a "UNIQUE INDEX" to enforce uniqueness, so you
get the index for "free". The foreign-key has no such constraint of course.

--
   Richard Huxton
   Archonet Ltd

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