SQL/Oracle: when indexes on multiple columns can be used

后端 未结 3 1930
日久生厌
日久生厌 2021-02-02 13:00

If I create an index on columns (A, B, C), in that order, my understanding is that the database will be able to use it even if I search only on (A), or (A and B), or (A and B an

3条回答
  •  心在旅途
    2021-02-02 13:40

    There are actually three index-based access methods that Oracle can use when a predicate is placed on a non-leading column of an index.

    i) Index skip-scan: http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#PFGRF10105

    ii) Fast full index scan: http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#i52044

    iii) Index full scan: http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#i82107

    I've most often seen the fast full index scan "in the wild", but all are possible.

提交回复
热议问题