Oracle 中的优化和重新编译提示?
Oracle 中是否有任何提示与这些 SQL Server 提示的工作方式相同?
重新编译:每次运行查询时都会重新编译(如果执行计划因参数而异)。与 Oracle 中的cursor_sharing 相比,这是否最好?
优化:当您希望计划针对某个参数进行优化,即使第一次运行 SQL 时使用了不同的参数时?我想也许对cursor_sharing也有帮助?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您使用的是 11g,Oracle 应使用 自适应默认情况下共享光标。如果您有一个使用绑定变量的查询,并且数据倾斜的列上的直方图表明不同的绑定变量值应使用不同的查询计划,Oracle 将自动为同一 SQL 语句维护多个查询计划。无需专门提示查询即可获得此行为,它已经融入到优化器中。
Since you're using 11g, Oracle should use adaptive cursor sharing by default. If you have a query that uses bind variables and the histogram on the column with skewed data indicates that different bind variable values should use different query plans, Oracle will maintain multiple query plans for the same SQL statement automatically. There would be no need to specifically hint the queries to get this behavior, it's already baked in to the optimizer.
我不知道,但在forums.oracle 这里找到了一些解决方案的讨论。 com
I didn't know, but found a discussion with some solutions here on forums.oracle.com