Question: I added an index hint in my query, but
the hint is being ignored. What is the correct syntax for an index hint
and how do I force the index hint to be used in my
query?
Answer: Oracle index hint
syntax is tricky because of the index hint syntax is incorrect it is treated as
a comment and not implemented. Here is an example of the correct syntax
for an index hint:
select /*+ index(customer
cust_primary_key_idx) */ * from customer;
Also note that of you alias the table, you must use the
alias in the index hint:
select /*+ index(c
cust_primary_key_idx) */ * from customer c;
Also, be vary of issuing hints that conflict with an
index hint. In this index hint example, the full hint is not consistent
with an index hint:
select /*+ full(c)
index(c cust_primary_key_idx) */ * from customer c;
相关文章
- 01-09PLSQL_性能优化系列13_Oracle Index Rebuild索引重建
- 01-09Oracle alter index rebuild 与 ORA-08104 说明
- 01-09ORACLE虚拟索引(Virtual Index)
- 01-09oracle11.2中分区功能测试之add&split partition对global&local index的影响
- 01-09Oracle 唯一 约束(unique constraint) 与 索引(index) 关系说明
- 01-09【DB笔试面试573】在Oracle中,常用Hint有哪些?
- 01-09index_ss hint 使用的运行计划变化对照
- 01-09SQL优化过程中常见Oracle HINT
- 01-09【DBAplus】SQL优化:一篇文章说清楚Oracle Hint的正确使用姿势
- 01-09ORACLE常用SQL优化hint语句