【问题标题】:What does loop in explain analyze statement mean?解释分析语句中的循环是什么意思?
【发布时间】:2018-09-18 21:29:10
【问题描述】:

我正在分析我的查询。

postgres=# explain analyze select * from student;
                                              QUERY PLAN
------------------------------------------------------------------------------------------------------
 Seq Scan on student  (cost=0.00..22.00 rows=1200 width=40) (actual time=0.005..0.005 rows=7 loops=1)
 Planning time: 0.035 ms
 Execution time: 0.019 ms
(3 rows)

我不知道Seq Scan on student (cost=0.00..22.00 rows=1200 width=40) (actual time=0.005..0.005 rows=7 loops=1) 中的loop=1 是什么意思。

我搜索了 postgres 文档,但没有找到任何关于循环参数的好的参考。

提前致谢。

【问题讨论】:

    标签: sql postgresql select sql-execution-plan explain


    【解决方案1】:

    PostgreSQL documentation 确实谈到了这一点:

    在某些查询计划中,子计划节点可能会执行多次。例如,在上面的嵌套循环计划中,每个外部行都会执行一次内部索引扫描。在这种情况下,loops 值报告节点的执行总数,显示的实际时间和行值是每次执行的平均值。这样做是为了使数字与成本估算的显示方式具有可比性。乘以 loops 值可得到在节点中实际花费的总时间。

    【讨论】:

      猜你喜欢
      • 2016-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-18
      • 2011-08-15
      • 2020-04-28
      • 1970-01-01
      • 2012-05-07
      相关资源
      最近更新 更多