卖水果的

操作系统、数据库、个人观点及学习过程

« 报表数据分栏显示远程操作数据库 »

Oracle 执行计划之 多个条件先后使用同一索引

SQL*Plus: Release 9.2.0.1.0 - Production on 星期三 2月 15 22:24:00 2010 

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. 


连接到: 
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production 
With the Partitioning, OLAP and Oracle Data Mining options 
JServer Release 9.2.0.1.0 - Production 

SQL> create table a as select * from dba_objects ; 

表已创建。 

SQL> create index a_ix on a(owner , object_type) ; 

Index created 

SQL> explain plan for select * from a where owner = 'SYS' and object_type ='TABLE' ; 

Explained 

SQL> select * from table(dbms_xplan.display) ; 

PLAN_TABLE_OUTPUT 
-------------------------------------------------------------------------------- 
--------------------------------------------------------------------------- 
| Id | Operation | Name | Rows | Bytes | Cost | 
--------------------------------------------------------------------------- 
| 0 | SELECT STATEMENT | | | | | 
| 1 | TABLE ACCESS BY INDEX ROWID| A | | | | 
|* 2 | INDEX RANGE SCAN | A_IX | | | | 
--------------------------------------------------------------------------- 
Predicate Information (identified by operation id): 
--------------------------------------------------- 
2 - access("A"."OWNER"='SYS' AND "A"."OBJECT_TYPE"='TABLE') 
Note: rule based optimization 

15 rows selected 

SQL> explain plan for select * from a where object_type ='TABLE' and owner = 'SYS' ; 

Explained 

SQL> select * from table(dbms_xplan.display) ; 

PLAN_TABLE_OUTPUT 
-------------------------------------------------------------------------------- 
--------------------------------------------------------------------------- 
| Id | Operation | Name | Rows | Bytes | Cost | 
--------------------------------------------------------------------------- 
| 0 | SELECT STATEMENT | | | | | 
| 1 | TABLE ACCESS BY INDEX ROWID| A | | | | 
|* 2 | INDEX RANGE SCAN | A_IX | | | | 
--------------------------------------------------------------------------- 
Predicate Information (identified by operation id): 
--------------------------------------------------- 
2 - access("A"."OWNER"='SYS' AND "A"."OBJECT_TYPE"='TABLE') 
Note: rule based optimization 

15 rows selected 

SQL>

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Walle Build 100427  Theme By Bokezhuti.cn

CopyRight 2009-2011 msgde.net , All rights reserved
联系站长:wmxcn2000@sina.com|MSN联系:msgde.net@hotmail.com