Kev*_*Kev 12 postgresql profiling function plpgsql
我花了一段时间才弄清楚,几周前我在外语维基上找到了答案,这非常有帮助,所以我想我会分享.
在Win32上的PostgreSQL 8.3上,默认情况下安装了profiling插件,但未加载.只需执行此SQL:
LOAD '$libdir/plugins/plugin_profiler.dll';
SET plpgsql.profiler_tablename = 'bazzybar';
Run Code Online (Sandbox Code Playgroud)
...然后当你想要描述一些代码时,
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
Run Code Online (Sandbox Code Playgroud)