Re: are foreign keys realized as indexes?

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: are foreign keys realized as indexes?
Дата
Msg-id 46406C64.8050401@iol.ie
обсуждение исходный текст
Ответ на Re: are foreign keys realized as indexes?  (Felix Kater <fkater@googlemail.com>)
Список pgsql-general
On 08/05/2007 13:14, Felix Kater wrote:

> There is *no complete* substitute for foreign keys by using *indexes*
> since I'd loose the referencial integrity (whereas for unique contraints
> there *is* a full replacement using indexes)?

Here's my understanding....an index is just that (an index) and no more
- it tells PostgreSQL where to look in a table to find a particular row
or set of rows. A foreign key, on the other hand, ensures that
referential integrity is enforced: it enforces the relationship between
rows in a table which refer to rows in another table, depending on how
the foreign key was specified in the first place (cf. the "ON UPDATE...
ON DELETE... etc. clauses).

When you have a foreign key, you can put an index on the foreign key
column in the "child" table for performance reasons, but this *isn't*
the same as the foreign key.

I don't know about the equivalence of unique constraints and indices -
others on the list can answer that.

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------

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

Предыдущее
От: "Anoo Pillai"
Дата:
Сообщение: Time of previous REINDEX execution..
Следующее
От: Felix Kater
Дата:
Сообщение: Re: are foreign keys realized as indexes?