| От | Gregory Stark |
|---|---|
| Тема | Re: Foreign keys and indexes |
| Дата | |
| Msg-id | 87hcpmcymz.fsf@oxford.xeocode.com обсуждение исходный текст |
| Ответ на | Foreign keys and indexes (Marc Compte <mcompte@sigte.udg.es>) |
| Список | pgsql-general |
"Marc Compte" <mcompte@sigte.udg.es> writes: > Does PostgreSQL create an implicit index also for foreign keys? or must I > create it explicitly? It won't allow you to create a foreign key that points to a column without a unique index on it. postgres=# create table b (i integer references a(i)); ERROR: there is no unique constraint matching given keys for referenced table "a" However if you ever update or delete the referenced records then it also helps performance to have an index on the referencing column which Postgres doesn't enforce. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера