【问题标题】:How do I enable the PostgreSQL function profiler?如何启用 PostgreSQL 函数分析器?
【发布时间】:2009-01-09 23:27:25
【问题描述】:

我花了一段时间才弄清楚,几周前我在外语维基上找到了答案,这很有帮助,所以我想我会分享。

【问题讨论】:

    标签: postgresql function profiling plpgsql


    【解决方案1】:

    在 Win32 上的 PostgreSQL 8.3 上,分析插件默认安装,但未加载。只需执行以下 SQL:

    LOAD '$libdir/plugins/plugin_profiler.dll';
    SET plpgsql.profiler_tablename = 'bazzybar';
    

    ...然后当你想分析一些代码时,

    drop table if exists bazzybar; -- reset the profiling stats
    select my_function_here('lala',123);  -- this line and variations as many times as you deem fit
    select * from bazzybar; -- show the time spent on each line of your function
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-18
      • 2010-09-26
      • 2013-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多