From: | "Richard Huxton" <dev(at)archonet(dot)com> |
---|---|
To: | "Jason Earl" <jdearl(at)yahoo(dot)com>, "Dr(dot) Evil" <drevil(at)sidereal(dot)kz>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Foreign keys? |
Date: | 2001-07-13 09:17:53 |
Message-ID: | 00b701c10b7c$b3a3ef00$1001a8c0@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From: "Jason Earl" <jdearl(at)yahoo(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Mark kirkwood | 2001-07-13 10:22:47 | How Postgresql Compares For Query And Load Operations |
Previous Message | Richard Huxton | 2001-07-13 09:11:46 | Re: \df+ and pg_proc query |