博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle PL/SQL之函数索引(Function-based indexes)使用示例
阅读量:6039 次
发布时间:2019-06-20

本文共 3968 字,大约阅读时间需要 13 分钟。

函数索引(Function-based indexes)只有在where条件使用了与索引中相同的基于相同列的函数时才起作用。 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://gkrhx.baihongyu.com/

你可能感兴趣的文章
基于清单的启动器的实现
查看>>
外网用户通过citrix打印慢的解决方法
查看>>
STL容器的使用
查看>>
关于std::map
查看>>
JXL导出Excel文件兼容性问题
查看>>
VBoot1.0发布,Vue & SpringBoot 综合开发入门
查看>>
centos7 安装wps 后 演示无法启动
查看>>
git简单命令
查看>>
LAMP编译部署
查看>>
XenDesktop7.6安装部署入门教程
查看>>
HashMap的工作原理及HashMap和Hashtable的区别
查看>>
GregorianCalendar日历程序
查看>>
Sublime 中运行 Shell 、Python、Lua、Groovy...等各种脚本
查看>>
【Java集合源码剖析】ArrayList源码剖析
查看>>
linux的目录结构
查看>>
这次逻辑通了,
查看>>
HTMLHelper
查看>>
快速构建Windows 8风格应用29-捕获图片与视频
查看>>
OC语言Block和协议
查看>>
使用xpath时出现noDefClass的错误(找不到某个类)
查看>>