Re: Foreign keys?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Foreign keys?
Дата
Msg-id 00b701c10b7c$b3a3ef00$1001a8c0@archonet.com
обсуждение исходный текст
Ответ на Re: Foreign keys?  (Jason Earl <jdearl@yahoo.com>)
Ответы Re: Foreign keys?  (Jason Earl <jdearl@yahoo.com>)
Список pgsql-general
From: "Jason Earl" <jdearl@yahoo.com>

> However, if you are going to do a lot of joins on your
> user table along the lines of:
>
> SELECT user.name, object.description FROM user, object
> WHERE user.number = object.owner;
>
> Then you might be better off simplifying just a bit to
> give you something like:
>
> CREATE TABLE user (
>        name VARCHAR(400) PRIMARY KEY
> );
>
> CREATE TABLE object (
>        owner VARCHAR(400) REFERENCES user NOT NULL,
>        description VARCHAR(200)
> );
>
> That would save you having to join the table to find
> the user.name at the expense of using more hard drive
> space.

I'm curious - are you speaking from a performance viewpoint here, or just
about simplifying queries (in which case I'd just slap a view on top)?

- Richard Huxton


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

Предыдущее
От: "Richard Huxton"
Дата:
Сообщение: Re: \df+ and pg_proc query
Следующее
От: Micah Yoder
Дата:
Сообщение: Re: Re: Pg7.2 (was: vacuum and 24/7 uptime)