Subject | Use of indexes |
---|---|
Author | tomsee7 |
Post date | 2011-12-27T18:33:30Z |
Can anyone explain why FB uses all 3 in the OR query yet only 2 in the AND query (See definitions below)?
Thanks,
Tom
------------------------------------------------
CREATE INDEX I_TARGET_COMPANY ON TARGET COMPUTED BY (UPPER(COMPANY));
CREATE INDEX I_TARGET_FIRSTNAME ON TARGET COMPUTED BY (UPPER(FIRSTNAME));
CREATE INDEX I_TARGET_LASTNAME ON TARGET COMPUTED BY (UPPER(lastname));
select * from target
where
upper(company) starting with 'A' or
upper(firstname) starting with 'B' or
upper(lastname) starting with 'C'
PLAN (TARGET INDEX (I_TARGET_COMPANY, I_TARGET_FORENAME, I_TARGET_LASTNAME))
select * from target
where
upper(company) starting with 'A' and
upper(firstname) starting with 'B' and
upper(lastname) starting with 'C'
PLAN (TARGET INDEX (I_TARGET_LASTNAME, I_TARGET_FORENAME))
Thanks,
Tom
------------------------------------------------
CREATE INDEX I_TARGET_COMPANY ON TARGET COMPUTED BY (UPPER(COMPANY));
CREATE INDEX I_TARGET_FIRSTNAME ON TARGET COMPUTED BY (UPPER(FIRSTNAME));
CREATE INDEX I_TARGET_LASTNAME ON TARGET COMPUTED BY (UPPER(lastname));
select * from target
where
upper(company) starting with 'A' or
upper(firstname) starting with 'B' or
upper(lastname) starting with 'C'
PLAN (TARGET INDEX (I_TARGET_COMPANY, I_TARGET_FORENAME, I_TARGET_LASTNAME))
select * from target
where
upper(company) starting with 'A' and
upper(firstname) starting with 'B' and
upper(lastname) starting with 'C'
PLAN (TARGET INDEX (I_TARGET_LASTNAME, I_TARGET_FORENAME))