I have two indexes
create index idx_ab on t(a,b)
create index idx_ba on t(b,a)
And I have only one query condition one this table
select * from t where a = x and b = y
Is there any performance difference on these two indexes?
I think in B+ tree structure, (a,b) is treated as one node(with two fields), so there is no performance difference on these two indexes.
Many blogs say that we should place the field with bigger cardinality at first. I think place the field with bigger cardinality at first, the index can be used for both "where a = x and b = y" and "where b = x and a = y". However, as for the only one query "where a = x and b = y", the two indexes are the same on performance.
Am I right?
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.