这花了我一段时间才弄清楚,几周前我在一个外语维基上找到了答案,它非常有帮助,所以我想我会分享。
最佳答案
在 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
关于postgresql - 如何启用 PostgreSQL 函数分析器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/430123/