问题:Oracle 在查询的where子句中,索引的索引列/前导列是否作为单个表谓词提供列才可以走该索引?第一 如果是,那么数据库要求在查询中使用索引,谓词列表中至少需要索引的第一列。例如:基础信息
如果想使用索引ind_test_01或者ind_test_03,查询语句where 谓词 必须有object_id 列,如:
第二 如果不是1.CBO可以使用索引快速全扫描( Index Fast Full Scan INDEX_FFS),只要索引包含所有的列查询需要,并且索引键中至少有一列具有NOT NULL约束。使用索引不需要谓词中包含索引的首列。注意,使用INDEX_FFS不一定返回已排序的行。排序取决于读取索引块的顺序,并且只有在使用'order by'子句时才能保证以排序的顺序返回行。如:
2.CBO可以使用索引跳过扫描( Index Skip Scan INDEX_SS)。对象不需要索引的首列要执行的INDEX_SS。针对 INDEX_SS ,MOS 解释如下可以增加理解:
Index
skip scans improve index scans against non-prefix columns since it is
often faster to scan index blocks than scanning table data blocks. A
non-prefix index is an index which does not contain a key column as its
first column.
This concept is easier to understand if one
imagines a prefix index to be similar to a partitioned table. In a
partitioned object the partition key (in this case the leading column)
defines which partition data is stored within. In the index case every
row underneath each key (the prefix column) would be ordered under that
key. Thus in a skip scan of a prefixed index, the prefixed value is
skipped and the non-prefix columns are accessed as logical sub-indexes.
The trailing columns are ordered within the prefix column and so a
'normal' index access can be done ignoring the prefix.
In this
case a composite index is split logically into smaller subindexes. The
number of logical subindexes depends on the cardinality of the initial
column. Hence it is now possible to use the index even if the leading
column is not used in a where clause.如:
3.CBO可以选择使用索引来避免排序。索引的列需要按by的顺序排列发生这种情况的条款。如:select object_id,owner,object_name from test where object_id=2 order by 1;
Oracle 在查询的where子句中,索引的索引列/前导列是否作为单个表谓词提供列进行匹配
来源:这里教程网
时间:2026-03-03 19:00:06
作者:
编辑推荐:
- Oracle 在查询的where子句中,索引的索引列/前导列是否作为单个表谓词提供列进行匹配03-03
- Oracle 标准审计,设置AUDIT_SYSLOG _LEVEL参数03-03
- system数据文件头损坏修复03-03
- 动态数据脱敏03-03
- 19c环境bbed安装及db_name查看03-03
- Oracle 23C 自动物化视图03-03
- 模拟ocr和vote盘的损坏恢复过程03-03
- ORACLE 23C 无锁列值保留详细说明及测试过程03-03
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- Oracle 在查询的where子句中,索引的索引列/前导列是否作为单个表谓词提供列进行匹配
- Oracle 标准审计,设置AUDIT_SYSLOG _LEVEL参数
Oracle 标准审计,设置AUDIT_SYSLOG _LEVEL参数
26-03-03 - 一次异常宕机后数据库启动报ora-600[4000]错误恢复
一次异常宕机后数据库启动报ora-600[4000]错误恢复
26-03-03 - 数据库数据恢复-Oracle数据库truncate table如何恢复数据?
- 创作新纪元:知乎、阅文加码AI大模型,撬动创作者经济
创作新纪元:知乎、阅文加码AI大模型,撬动创作者经济
26-03-03 - 一次dbms_metadata.get_ddl时报ORA-06502和ORA-06512错误
- 闪回冲突怎么办?
闪回冲突怎么办?
26-03-03 - ORA-39014问题处理
ORA-39014问题处理
26-03-03 - 淘宝的“泛娱乐化”自救?
淘宝的“泛娱乐化”自救?
26-03-03 - 直播、AI赋能,美团披着荆棘前行
直播、AI赋能,美团披着荆棘前行
26-03-03
