How do non unique composite indexes work ??
Had this very basic question about indexes. If I have an index with columns A,B,C in that order, and I have A and C in the WHERE clause, will the value for C be used while searching for the index ?? or it will pick up only A and do a range scan only based on A ??
Lets say I have a table like this.
SQL> create table test_index_behav
2 ( emp_id number,
3 job_code number,
4 join_date date,
5 some_thing VARCHAR2(50) );
Table created.
SQL> create index test_index_behav_fk
2 on test_index_behav(emp_id,job_code,join_date);
Index created.
Now if I write a query like this, the index would come into effect in full performance.
select *
from test_index_behav
where emp_id = :1
and job_code = :2
and join_date = :3.
This will give me best performance. Since the order of the columns in the index is emp_id-job_code-join_date, if I give the query like below
select * from test_index_behav
where emp_id = :1
and join_date = :2 , will the range scan consider :2 for searching the index ?? Or is it same as ( performance wise; I understand the results would be different )
select *
from test_index_behav
where emp_id = :1
??
Thanks for your time in advance.
Ashok.