basic DB design question / joins
От | Kyle |
---|---|
Тема | basic DB design question / joins |
Дата | |
Msg-id | 8hkcqc$4m1$1@ip146.usw5.rb1.bel.nwlink.com обсуждение исходный текст |
Список | 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@_nwlink_._com_
В списке pgsql-general по дате отправления: