Why you not try it :-)I did a trial in SQL Navigator 3:create table test (
col1 VARCHAR2(2) NOT NULL,
col2 VARCHAR2(2) NOT NULL,
col3 VARCHAR2(2) NOT NULL,
col4 VARCHAR2(2) NOT NULL
);CREATE UNIQUE INDEX TA_UN1 ON test(col1,col4) ;
insert into test values ('A','B','C','A');
insert into test values ('A','C','D','B');
insert into test values ('A','D','A','C');
insert into test values ('A','A','B','D');
insert into test values ('B','A','B','A');
insert into test values ('B','B','C','B');
commit;explain result:A.
select * from test
WHERE col1='A' AND col2='B';Index(Range Scan)B.
select * from test
WHERE col4='D' AND col1='A' AND col2='B';Index(Unique Scan)C.
select * from test
WHERE col1='A' AND col4='D' OR col3='C'; full table scanD.
select * from test
WHERE col1='A' AND col3<>'C'AND col4='D'
Index(Unique Scan)All the query are run in RULE based optimizer
col1 VARCHAR2(2) NOT NULL,
col2 VARCHAR2(2) NOT NULL,
col3 VARCHAR2(2) NOT NULL,
col4 VARCHAR2(2) NOT NULL
);CREATE UNIQUE INDEX TA_UN1 ON test(col1,col4) ;
insert into test values ('A','B','C','A');
insert into test values ('A','C','D','B');
insert into test values ('A','D','A','C');
insert into test values ('A','A','B','D');
insert into test values ('B','A','B','A');
insert into test values ('B','B','C','B');
commit;explain result:A.
select * from test
WHERE col1='A' AND col2='B';Index(Range Scan)B.
select * from test
WHERE col4='D' AND col1='A' AND col2='B';Index(Unique Scan)C.
select * from test
WHERE col1='A' AND col4='D' OR col3='C'; full table scanD.
select * from test
WHERE col1='A' AND col3<>'C'AND col4='D'
Index(Unique Scan)All the query are run in RULE based optimizer
解决方案 »
- pb连接oracle10提示oci.dll could not be loaded
- 关于oracle 10g 不想显示部分数据的问题
- sqleserver<----->oracle定时同步的问题
- oracle语法求助
- oracle磁盘空间满了,请大家帮助,感激万分,很急
- 【如何实现】任意 同构表 之间的数据备份和恢复
- 修改oracle中的package名后
- imp 报错啊,,,大虾们,快来帮帮我啊~~~~!!!!!!!!!!!!
- 关于row_number()的一点问题?
- 【Oracle】存储过程,不等于查询失败 WHERE ID<>vID
- 数据导出与导入简单问题,多谢了
- oracle 9i的客户端可以连接oracle 8.0.0.5的服务器端吗?
的确不用索引,因为OR col3=’C’怎么也要全表扫描。我马虎了没看到"or"。
实践的确很重要:)
和sqlplus一样的嘛?
她可以看到:是full scan 或者 index ??
谢谢指教