Forcing an index in oracle

孤人 提交于 2020-01-07 06:27:19

问题


I have a query joining lots of fields. For some strange reason the index for one table is not being used at all( I use the index key clearly), instead it is doing a FULL table scan. I would like to force the index. We used to do optimizer hints in sybase. Is there a similar hint available in oracle? For example, in sybase to join tables a, b, c and use myindex in table a, I would do :

SELECT a.*
FROM     a(INDEX myindex),
         b,
         c
WHERE    a.field1 = b.field1
AND      b.field1 = c.field1

Question is how do I do this in oracle. Thanks Saro


回答1:


Yes, there is a hint like that in Oracle. It looks something like this:

select /*+ index(a my_index) */ from a


来源:https://stackoverflow.com/questions/7418860/forcing-an-index-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!