I have a table T with many columns whose values are are lookup keys
id_1, id_2, id_3, id_4, id_5, ..., id_26

The values corresponding to the keys live in table L, the lookup table:
id, id_value

T might have 100K rows and L 500K rows.

I am wondering what would be the best view (performance-wise) to see the values?

-----
Method one - join

create view V1 as
select a.id_value as v_1, ... z.id_value as v_26
from 
T, L as a, L as b, ..., L as z
where
    a.id = T.id_1
and b.id = T.id_2
...
and z.id = T.id_26

-----
Method two - sub-query

create view V2 as
select
  (select id_value from L where id = id_1) as v_1
, (select id_value from L where id = id_2) as v_2
...
, (select id_value from L where id = id_26) as v_26


TIA,
Richard

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to