From: | Kyle <kaf(at)_nwlink_(dot)_com_> |
---|---|
To: | pgsql-general(at)postgresql(dot)org(dot)pgsql-questions(at)postgresql(dot)org |
Subject: | basic DB design question / joins |
Date: | 2000-06-07 02:42:20 |
Message-ID: | 8hkcqc$4m1$1@ip146.usw5.rb1.bel.nwlink.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I'm designing a database (which not my forte) and I've got a basic
question. Is it any faster to do a "join" on a pair of integers
(oids) that it is a text string that is declared as a primary/foreign
key pair?
Case A:
create table foo1 ( name text primary key, ... );
create table foo2 ( foo1_name text references foo1, ... );
select * from foo1, foo2 where foo1.name = foo2.foo1_name;
Case B:
create table bar1 ( oid integer primary key, name text, ... );
create table bar2 ( bar1_oid integer references bar1, ... );
select * from bar1, bar2 where bar1.oid = bar2.bar1_oid;
Given that the text string is indexed in Case A (it's the primary
key), I'm wondering if their is any advantage to the oid scheme? The
oid seems redundant since the database will have already assigned an
unique identifier to each row...am I missing anything? Will I need to
declare an index on the foreign key in table foo_2? Is their any
advantage to the oid scheme?
Thanks,
Kyle
kaf(at)_nwlink_(dot)_com_
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-06-07 04:09:45 | Re: Composite Types |
Previous Message | The Hermit Hacker | 2000-06-07 02:27:26 | Re: Are the subscription CDs version 7 |