解释计划的差异 gather_plan_statistics

Difference on explain plan and gather_plan_statistics

谁能告诉我什么时候应该使用 gather_plan_statistics 提示或者什么时候应该使用解释计划。 gather_plan_statistics 提示的实际目的是什么。

是的,它看起来很混乱但很简单:

  • 解释计划查看查询并创建理论上的执行计划。
  • Gather_plan_statistics指示优化器在实际执行过程中做笔记,以便能够将理论与实际进行比较。

详情见this question

更好的选择是生成 SQL 监控报告。 SQL 是自动监控的,所以不需要重新 运行 提示。 SQL 监控报告提供的信息比 gether_plan_statistics 多得多。 最后,gather_plan_statistics 中的统计数据在执行并行查询时不可靠。