Re: Matching unique primary keys - Mailing list pgsql-general

From Shridhar Daithankar
Subject Re: Matching unique primary keys
Date
Msg-id 3DB8686C.14874.2711EA3@localhost
Whole thread Raw
In response to Re: Matching unique primary keys  (Kevin Old <kold@carolina.rr.com>)
List 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


pgsql-general by date:

Previous
From: Brian Hirt
Date:
Subject: Re: 7.3b2 strangeness
Next
From: "Johnson, Shaunn"
Date:
Subject: primary key