Question about indices:
There is a question which often occures when planning the data model for an application and creating some sql scripts. The question is: when I create indices do I have to create an Index for every where condition or does an index match for any inexed field (I'm talking about Oracle)?!
For example:
CREATE INDEX payment_idx ON dos_payment (orig_time_stamp, loan_id);
Matches this Index only for
--> ....where orig_time_stamp = 'xxx' and loan_id = 'xxx' <--
or does it also for
--> ....where orig_time_stamp = 'xxx' <--
or
--> ....where loan_id = 'xxx' <--
Thx.
I ask because I always thought it is the first esplained way untill I got a strange Oracle Warning, that pointed out that the column xxx is already indexed.
There is a question which often occures when planning the data model for an application and creating some sql scripts. The question is: when I create indices do I have to create an Index for every where condition or does an index match for any inexed field (I'm talking about Oracle)?!
For example:
CREATE INDEX payment_idx ON dos_payment (orig_time_stamp, loan_id);
Matches this Index only for
--> ....where orig_time_stamp = 'xxx' and loan_id = 'xxx' <--
or does it also for
--> ....where orig_time_stamp = 'xxx' <--
or
--> ....where loan_id = 'xxx' <--
Thx.
I ask because I always thought it is the first esplained way untill I got a strange Oracle Warning, that pointed out that the column xxx is already indexed.