【发布时间】:2009-01-09 23:27:25
【问题描述】:
我花了一段时间才弄清楚,几周前我在外语维基上找到了答案,这很有帮助,所以我想我会分享。
【问题讨论】:
标签: postgresql function profiling plpgsql
我花了一段时间才弄清楚,几周前我在外语维基上找到了答案,这很有帮助,所以我想我会分享。
【问题讨论】:
标签: postgresql function profiling plpgsql
在 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
【讨论】: