不使用该表上指定的索引进行存取,仍然可以使用其它的索引进行索引扫描
SELECT /*+ FULL(e) */ employee_id, last_name FROM employees e WHERE last_name LIKE :b1;
SELECT /*+ROWID(employees)*/ * FROM employees WHERE rowid > 'AAAAtkAABAAAFNTAAA' AND employee_id = 155;
SELECT /*+ INDEX(A sex_index) use sex_index because there are few male patients */ A.name, A.height, A.weight FROM patients A WHERE A.sex = ’m’;
SELECT /*+NO_INDEX(employees emp_empid)*/ employee_id FROM employees WHERE employee_id > 200;
指示连接顺序的hints: ORDERED /*+ ORDERED */ 按from 字句中表的顺序从左到右的连接 STAR /*+ STAR */ 指示优化器使用星型查询 SELECT /*+ORDERED */ o.order_id, c.customer_id, l.unit_price * l.quantity FROM customers c, order_items l, orders o WHERE c.cust_last_name = :b1 AND o.customer_id = c.customer_id AND o.order_id = l.order_id; /*+ ORDERED USE_NL(FACTS) INDEX(facts fact_concat) */
指示连接类型的hints: USE_NL /*+ USE_NL ( table [,table, ...] ) */ 使用嵌套连接 USE_MERGE /*+ USE_MERGE ( table [,table, ...]) */ 使用排序- -合并连接 USE_HASH /*+ USE_HASH ( table [,table, ...]) */ 使用HASH连接 注意:如果表有alias(别名),则上面的table指的是表的别名,而不是真实的表名 具体的测试实例: create table A(col1 number(4,0),col2 number(4,0), col4 char(30)); create table B(col1 number(4,0),col3 number(4,0), name_b char(30)); create table C(col2 number(4,0),col3 number(4,0), name_c char(30));
select A.col4 from C , A , B
上一篇:通过分析SQL语句的执行计划优化SQL(三)
下一篇:数据库Oracle9i的企业管理器介绍
|