在Oracle中强制索引 [英] Forcing an index in oracle
问题描述
我有一个查询,其中包含许多字段.出于某种奇怪的原因,一个表的索引根本没有使用(我清楚地使用了索引键),而是进行了全表扫描.我想强制索引.我们曾经在sybase中做优化器提示. oracle中有类似的提示吗? 例如,在sybase中加入表a,b,c并在表a中使用myindex,我会这样做:
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
问题是我该如何在oracle中执行此操作. 谢谢 萨罗
Question is how do I do this in oracle. Thanks Saro
推荐答案
是的,Oracle中有类似的提示.看起来像这样:
Yes, there is a hint like that in Oracle. It looks something like this:
select /*+ index(a my_index) */ from a
这篇关于在Oracle中强制索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!