失效索引oracle会自动编译一次

[复制链接]
查看11 | 回复1 | 2006-9-7 17:03:51 | 显示全部楼层 |阅读模式
SQL> create table c (a int);
表已创建。
SQL> create view vc as select * from c;
视图已创建。
SQL> alter table c modify (a varchar(10));
表已更改。
SQL> select object_name,object_type,status from dba_objects where object_name='VC';
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE STATUS
------------------- -------
VC
VIEW
INVALID

SQL> alter session set sql_trace=true;
会话已更改。
SQL> select *from vc;
未选定行
SQL> alter session set sql_trace=false;
会话已更改。
SQL> select object_name,object_type,status from dba_objects where object_name='VC';
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE STATUS
------------------- -------
VC
VIEW
VALID

SQL>

alter session set sql_trace=true

call count cpuelapsed diskquerycurrentrows
------- -------------- ---------- ---------- ---------- --------------------
Parse00.00 0.00
0
0
0 0
Execute10.00 0.00
0
0
0 0
Fetch00.00 0.00
0
0
0 0
------- -------------- ---------- ---------- ---------- --------------------
total10.00 0.00
0
0
0 0
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 30
********************************************************************************
ALTER VIEW "TEST"."VC" COMPILE

call count cpuelapsed diskquerycurrentrows
------- -------------- ---------- ---------- ---------- --------------------
Parse10.03 0.03
0
1
0 0
Execute10.00 0.00
0
0
0 0
Fetch00.00 0.00
0
0
0 0
------- -------------- ---------- ---------- ---------- --------------------
total20.03 0.04
0
1
0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 30 (recursive depth: 1)
********************************************************************************
select *from vc

call count cpuelapsed diskquerycurrentrows
------- -------------- ---------- ---------- ---------- --------------------
Parse10.00 0.00
0
1
1 0
Execute10.00 0.00
0
0
0 0
Fetch10.00 0.00
0
3
0 0
------- -------------- ---------- ---------- ---------- --------------------
total30.00 0.00
0
4
1 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 30
Rows Row Source Operation
----------------------------------------------------------
0TABLE ACCESS FULL C (cr=3 pr=0 pw=0 time=45 us)
********************************************************************************
alter session set sql_trace=false
回复

使用道具 举报

千问 | 2006-9-7 17:03:51 | 显示全部楼层
是视图不是索引
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行