3

Is there any hints in Oracle that works the same way as these SQL Server hints?

Recompile: That a query is recompiled every time it's run (if execution plans should vary greatly depending on parameters). Would this be best compared to cursor_sharing in Oracle?

Optimize for: When you want the plan to get optimized for a certain parameter even if a different one is used the first time the SQL is run? I guess maybe could be helped with cursor_sharing as well?

4

2 回答 2

2

我不知道,但在 forums.oracle.com 上找到了一些解决方案的讨论

于 2011-02-23T11:50:53.027 回答
2

由于您使用的是 11g,Oracle 应该默认使用自适应游标共享。如果您有一个使用绑定变量的查询,并且带有倾斜数据的列上的直方图表明不同的绑定变量值应该使用不同的查询计划,Oracle 将自动为同一 SQL 语句维护多个查询计划。不需要特别提示查询来获得这种行为,它已经融入优化器。

于 2011-02-23T15:13:51.230 回答