Re: are foreign keys realized as indexes?

Поиск
Список
Период
Сортировка
От Lew
Тема Re: are foreign keys realized as indexes?
Дата
Msg-id m4GdnaDx3PS4cNzbnZ2dnUVZ_jydnZ2d@comcast.com
обсуждение исходный текст
Ответ на Re: are foreign keys realized as indexes?  (Felix Kater <fkater@googlemail.com>)
Ответы Re: are foreign keys realized as indexes?  ("Peter Childs" <peterachilds@gmail.com>)
Список pgsql-general
Felix Kater wrote:
> I am not bound to indexes, however, wonder if foreign keys itself are
> non-atomic functionality. I mean: if foreign keys are based on some
> other lower level functionality like indexes or anything else which I
> could use as a substitute--in what way ever. Of course, I want to
> gain the same (referential integrity etc.).
>
> If foreign keys are, however, something unique which can't be replaced
> by any other pg function (I am of course not taking into account things
> like multiple queries bound together by transactions...) then I have to
> go though it and implement it into my pg interface (looking at the
> information_schema: This seems to be quite a bunch of work...).

Semantics are not a trivial thing.

Foreign keys are a fundamental semantic of the relational model.  They do not
mean the same thing as an index at all.

I find it strange that anyone would resist the notions of primary and foreign
keys, when they are the basis of the relational model.  Indexes aren't even
part of the relational model - they are a hack to enhance performance.

Sure they ultimately break down to machine instructions, but that's in a whole
different domain of discourse.  A data model is built up from primary keys,
foreign keys and dependent data.  They are fundamental.  They /are/ the
building blocks of your database.  Expressing these molecular concepts in
terms of their constituent atoms will not convey the molecular properties; you
lose a tremendous amount of information.

Just use the syntax that best expresses your structure: PRIMARY KEY and
FOREIGN KEY.

--
Lew

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

Предыдущее
От: Gerard M
Дата:
Сообщение: Re: Issue with database Postgresql :(
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Views- Advantages and Disadvantages