Oracle PL/SQL之函数索引(Function-based indexes)使用示例
2011-08-29 23:30
771 查看
函数索引(Function-based indexes)只有在where条件使用了与索引中相同的基于相同列的函数时才起作用。
REF:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm
duzz$scott@orcl>set autotrace on duzz$scott@orcl>create table t1 as select * from dept; Table created. Elapsed: 00:00:00.01 duzz$scott@orcl>create index loc_idx on t1(upper(loc)); Index created. Elapsed: 00:00:00.06 duzz$scott@orcl>select * from t1 where deptno=20; DEPTNO DNAME LOC ---------- ------------------------------------------ ------------ 20 RESEARCH DALLAS Elapsed: 00:00:00.00 Execution Plan ---------------------------------------------------------- Plan hash value: 3617692013 -------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 30 | 3 (0)| 00:00:01 | |* 1 | TABLE ACCESS FULL| T1 | 1 | 30 | 3 (0)| 00:00:01 | -------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter("DEPTNO"=20) Note ----- - dynamic sampling used for this statement Statistics ---------------------------------------------------------- 48 recursive calls 0 db block gets 12 consistent gets 0 physical reads 0 redo size 533 bytes sent via SQL*Net to client 385 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed duzz$scott@orcl>select * from t1 where loc='DALLAS'; DEPTNO DNAME LOC ---------- ------------------------------------------ ----------------- 20 RESEARCH DALLAS Elapsed: 00:00:00.00 Execution Plan ---------------------------------------------------------- Plan hash value: 3617692013 -------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 30 | 3 (0)| 00:00:01 | |* 1 | TABLE ACCESS FULL| T1 | 1 | 30 | 3 (0)| 00:00:01 | -------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter("LOC"='DALLAS') Note ----- - dynamic sampling used for this statement Statistics ---------------------------------------------------------- 5 recursive calls 0 db block gets 8 consistent gets 0 physical reads 0 redo size 533 bytes sent via SQL*Net to client 385 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed duzz$scott@orcl>select * from t1 where upper(loc)='DALLAS'; DEPTNO DNAME LOC ---------- ------------------------------------------ ---------------------- 20 RESEARCH DALLAS Elapsed: 00:00:00.01 Execution Plan ---------------------------------------------------------- Plan hash value: 3763008475 --------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 30 | 2 (0)| 00:00:01 | | 1 | TABLE ACCESS BY INDEX ROWID| T1 | 1 | 30 | 2 (0)| 00:00:01 | |* 2 | INDEX RANGE SCAN | LOC_IDX | 1 | | 1 (0)| 00:00:01 | --------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access(UPPER("LOC")='DALLAS') Note ----- - dynamic sampling used for this statement Statistics ---------------------------------------------------------- 28 recursive calls 0 db block gets 9 consistent gets 0 physical reads 0 redo size 533 bytes sent via SQL*Net to client 385 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed duzz$scott@orcl>
REF:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm
相关文章推荐
- Oracle PL/SQL之函数索引(Function-based indexes)使用示例
- Oracle PL/SQL之函数索引(Function-based indexes)使用示例
- 使用wrap和unwrap加密解密Oracle的PL/SQL对象(包,存储过程,函数等)代码
- 使用wrap和unwrap加密解密Oracle的PL/SQL对象(包,存储过程,函数等)代码
- Oracle模糊查询之(3.3从使用函数和sql语法角度来提高模糊查询效率 三)使用Oracle的instr函数与索引配合提高模糊查询的效率
- oracle pl/sql 函数中使用数组
- oracle pl/sql 函数中链表的使用
- ORACLE数库之PL/SQL高级篇 存储过程,函数,包,触发器的使用
- 【转载】Oracle使用技巧及PL/SQL Developer配置
- Oracle PL/SQL开发基础(第四弹:索引)
- oracle pl/sql 函数
- 使用instantclient_11_2 和PL/SQL Developer工具包连接oracle 11g远程数据库
- ORACLE PL/SQL编程之六:把过程与函数说透
- Oracle 中Java 对象与PL/SQL类型的映射及使用
- oracle 性能优化操作十四: 使用基于函数的索引
- Oracle PL/SQL中异常高级特性示例解析
- 本机不安装Oracle客户端,使用PL/SQL Developer连接远程数据库
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE
- PL/SQL 函数创建 示例
- oracle 数据库的管理工具 PL/SQL_Developer 的简易使用 与Java 连接并查询显示出数据