Is there anybody who can tell me about the following:
How does an 8.1.6 server maintain the foreign keys ? Does it create
an index
automatically ? Or do I have to build one ?
When I have to tables a (Fields: a.a_id, a.a_name) and b (Fields:
b.b_id,
b.b_name), and a link table named lnk_a_b (Fields: lnk_a_b.a_id,
lnk_a_b.b_id), and a foreign key relationship between all tables is
established, how is a select statement processed:
select a.a_id, a.a_name, b.b_id, b.b_name
from a, b, lnk_a_b
where lnk_a_b.a_id = a.a_id and lnk_a_b.b_id = b.b_id;
Are the foreign key indices used, and do I have to build them
or does
8.1.6. do this for me ?
Answer 1:
Foreign keys are not created automatically,
and yes, you SHOULD create them.
Hth,
Sybrand Bakker, Oracle DBA
Answer 2:
The only constraints that automatically create indexes are the Primary
Key
constraint, and the Unique constraint. You must create indexes
for any
foreign keys that you create manually (assuming you want indexes on
these
foreign keys). Also, you do not need pre-built relationships to join
tables
in a query.
Mike