我如何启用PostgreSQL功能分析器? [英] How do I enable the PostgreSQL function profiler?
本文介绍了我如何启用PostgreSQL功能分析器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<在Win32上的PostgreSQL 8.3上,概要分析插件是默认安装的,但没有加载。只需执行这个SQL:
LOAD'$ libdir / plugins / plugin_profiler.dll';
SET plpgsql.profiler_tablename ='bazzybar';
...然后当您想要剖析某些代码时,
drop table if exists bazzybar; - 重置分析统计数据
select my_function_here('lala',123); - 这条线和变化多次,你认为适合
select * from bazzybar; - 显示你的函数的每一行花费的时间
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.
解决方案
On PostgreSQL 8.3 on Win32, the profiling plugin is installed by default, but not loaded. Just execute this 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
这篇关于我如何启用PostgreSQL功能分析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文