【问题标题】:Analyze stored procedures in PostgreSQL分析PostgreSQL中的存储过程
【发布时间】:2018-09-26 06:09:42
【问题描述】:

所以我在 PostgreSQL 中有一个复杂的、近 200 行长的存储过程,我想快速分析它,但不幸的是 PgAdmin 内置的解释分析函数不支持嵌套循环,它不能让我深入了解,所以我用以下内容更新了我的postgresql.conf 文件:

auto_explain.log_analyze = true
auto_explain.log_timing = true
auto_explain.log_verbose = true
auto_explain.log_min_duration = '0ms'
auto_explain.log_nested_statements = true
auto_explain.log_buffers = true

所以我可以在我的 pg_log 文件夹中看到详细的日志,但它会生成近 300 行长的结果日志,并且不容易分析。

有没有更好、更优雅的方法来做到这一点?也许在 Windows 上有一个 UI 工具?

【问题讨论】:

标签: postgresql explain


【解决方案1】:

正如@a_horse_with_no_name 在 cmets 中建议的那样,explain.depesz.com 站点非常有用。只需复制粘贴您的解释分析计划,然后查看输出。您可以单击列标题,让它知道哪个参数对您最重要——独占节点时间、包含节点时间或行数错误估计。

About explain.depesz.com

【讨论】:

    【解决方案2】:

    虽然 explain.depesz.com 非常有用,但您也可以使用 https://github.com/bigsql/plprofiler 分析您的程序。您可以结合使用这两种工具

    【讨论】:

    • 那个链接好像坏了:(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-24
    • 2011-05-09
    • 1970-01-01
    相关资源
    最近更新 更多