易网时代-编程资源站
Welcome
微信登录
首页
/
数据库
/
MySQL
/
Oracle PL/SQL之函数索引(Function-based indexes)使用示例
函数索引(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://download.Oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm
Oracle PL/SQL正则表达式之脱字符caret(^)与中括号square brankets([])的组合使用小例Oracle PL/SQL之WITH查询相关资讯 oracle
[INS-32052] Oracle基目录和Oracle (07/22/2014 07:41:41)
Oracle 4个大对象(lobs)数据类型 (02/03/2013 12:33:05)
Oracle按时间段分组统计 (07/26/2012 10:36:48)
[Oracle] dbms_metadata.get_ddl的 (07/12/2013 07:37:30)
Liferay Portal 配置使用Oracle和 (07/31/2012 20:07:18)
Concurrent Request:Inactive (07/20/2012 07:44:05)
本文评论 查看全部评论 (0)
表情: 姓名:
匿名
字数
版权所有©石家庄振强科技有限公司2024
冀ICP备08103738号-5
网站地图