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;

相关文章:

  • 2022-01-22
  • 2021-06-20
  • 2021-05-24
  • 2022-12-23
  • 2022-01-11
  • 2021-10-07
  • 2021-09-06
猜你喜欢
  • 2022-12-23
  • 2021-04-29
  • 2021-11-04
  • 2022-02-16
  • 2021-07-12
  • 2022-12-23
相关资源
相似解决方案