database - Are foreign keys that are part of a composite key automatically indexed in Oracle? -


for instance, if have students table:

create table student (     student_id number(8),     student_name varchar2(30),     constraint pk_student primary key (student_id) ); 

and subject table:

create table subject (     subject_id number(8),     subject_name varchar2(30),     constraint pk_subject primary key (subject_id) ); 

and create third table of student's favorites subjects:

create table fav_sub (     student_id number(8),     subject_it number(8),     constraint pk_fav_sub primary key (student_id, subject_id),     constraint fk_1_fav_sub foreign key (student_id) references student(student_id),     constraint fk_2_fav_sub foreign key (subject_id) references subject(subject_id) ); 

do need manually create indexes foreign keys in fav_sub table such as:

create index in_1_fav_sub on fav_sub(student_id); create index in_2_fav_sub on fav_sub(subject_id); 

or indexes foreign keys automatically created database, since they're part of composite key?

edit: clarify, i'm not asking if index foreign key automatically created, i'm asking if index foreign key created when it's part of composite key, since oracle automatically indexes primary keys.

the creation of primary key indexes combination of [student_id, subject_id]. adding foreign key constraints each individual column not create index on them, , if want (which idea), you'd have manually create it.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -