This took me a while to figure out and I found the answer on a foreign-language wiki a number of weeks ago, and it was very helpful, so I thought I would share.
我花了一段时间才弄明白,几周前我在外语维基上找到了答案,这非常有帮助,所以我想我会分享。
1 个解决方案
#1
9
On PostgreSQL 8.3 on Win32, the profiling plugin is installed by default, but not loaded. Just execute this SQL:
在Win32上的PostgreSQL 8.3上,默认情况下安装了profiling插件,但未加载。只需执行此SQL:
LOAD '$libdir/plugins/plugin_profiler.dll';
SET plpgsql.profiler_tablename = 'bazzybar';
...and then when you want to profile some code,
...然后当你想要描述一些代码时,
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
#1
9
On PostgreSQL 8.3 on Win32, the profiling plugin is installed by default, but not loaded. Just execute this SQL:
在Win32上的PostgreSQL 8.3上,默认情况下安装了profiling插件,但未加载。只需执行此SQL:
LOAD '$libdir/plugins/plugin_profiler.dll';
SET plpgsql.profiler_tablename = 'bazzybar';
...and then when you want to profile some code,
...然后当你想要描述一些代码时,
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