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

有帮助吗?

解决方案

在Win32上的PostgreSQL 8.3上,默认安装了profiling插件,但未加载。只需执行此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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top