请注意,用以搜索列的操作符也扮演着决定级别的角色,有时甚至考虑索引的时间作为级别 例如下面的表证明了在列1和列2上的索引使用情况,如果它们两个在where子句上用”=”连接 例: select * from am79 where col1 = 1 and col2 = 'amar'; -- here both col1 and col2 are indexed. -------------------------------------------------------- Normal index types | Index used in RBO column1(a) column2(b)column1+column2(c) | -------------------------------------------------------- non-uniquenon-unique c non-unique non-unique a + b non-unique non-uniquenon-unique c unique non-unique a unique non-unique a unique unique b (the most recent index created) unique uniqueunique c ------------------------------------------------------ -The above is tested on Oracle 8.1.7.1. -In case of non-unique single column indexes, both indexes are used. -In case of unique indexes, they are not combined for execution plan, any one is taken. -Preference is given to the index available with the "=" operator column, than with others operators. -Don't create bitmap & function-based indexes, these will not work in RBO. --------------------------------------------------------- RBO偏好Oracle早期版本的大多数设置作为执行计划路径,这种选择是统一的。查询总会产生同样的方法对于运行在不同数据库上相同的应用程序(待续).
|