Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Optimizing long string foreign keys
"Boris Pelakh" <pelakh_at_yahoo.com> wrote in message news:44ec9ada.0308070547.7fb3611b_at_posting.google.com...
> How can I resolve this problem ? I have considered auto-sequencing
> table A,
> and storing just the sequence number as a reference in table B, but I
That technique is called "using a surrogate key". It is quite effective at solving this problem.
> have
> a frequent need to do the following
>
> select <fields> from TableB where TableA_key = '<some value>';
>
> which would now force a JOIN. Is there a better solution ?
Nothing wrong with a join. If it is indexed properly, it is nearly as fast as a single table access. I'm assuming this long key is unique.
-- Cheers Nuno Souto wizofoz2k_at_yahoo.com.au.nospamReceived on Fri Aug 08 2003 - 07:09:53 CDT