Re: Matching unique primary keys

From: "Shridhar Daithankar" <shridhar_daithankar(at)persistent(dot)co(dot)in>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Matching unique primary keys
Date: 2002-10-24 16:08:52
Message-ID: 3DB8686C.14874.2711EA3@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 23 Oct 2002 at 12:39, Kevin Old wrote:

> 1) Copy the 3 "unique fields" into every table (as you mention above).
> My only question with this is how am I to do a join on a multicolumn
> primary key? The only thing I can think of would be something like:
>
> SELECT *
> FROM data_index, data_tbl
> WHERE data_index.id1 = data_tbl.id1
> AND data_index.id2 = data_tbl.id2
> AND data_index.id3 = data_tbl.id3

Well you can store the 3 fields in a table, declare the combination of them as
primary key and add a fourth field that is sequence generated and use this
sequence number as primary key in rest of them tables. Will reuce the IO
requirement by oodles..

HTH

Bye
Shridhar

--
ASCII: The control code for all beginning programmers and those who would
become computer literate. Etymologically, the term has come down as a
contraction of the often-repeated phrase "ascii and you shall receive." --
Robb Russon

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Johnson, Shaunn 2002-10-24 17:17:32 primary key
Previous Message Brian Hirt 2002-10-24 15:58:39 Re: 7.3b2 strangeness