以前对前导列的理解一直是:组合索引(concatenated index) 由多个列构成的索引,如create index idx_emp on emp(col1, col2, col3, ……),则我们称idx_emp索引为组合索引。在组合索引中有一个重要的概念:引导列(leading column),在上面的例子中,col1列为引导列。当我们进行查询时可以使用”where col1 = ? ”,也可以使用”where col1 = ? and col2 = ?”,这样的限制条件都会使用索引,但是”where col2 = ? ”查询就不会使用该索引。当然某些情况下会走Index full scan或者FTS之类的。
但是我现在
CREATE INDEX idx_app_unionON app(OPERDATE,OPERNUMBER,OPERNAME)NOLOGGING
然后我
selectoperdate,OPERNUMBER,OPERNAMEfrom app where OPERNUMBER='xie' and OPERNAME like '%超%' and operdate>'01-May-12' and operdateTO_TIMESTAMP('01-May-12') AND "OPERNUMBER"='xie' AND
"OPERDATE"'01-May-12' and operdateTO_TIMESTAMP('01-May-12') AND
"OPERDATE"'01-May-12' and operdate'01-May-12' and operdate
嗯 以前一直认为的是,只有where后面第一个条件是operdate 相关,才会走NDEX RANGE SCAN
|