views:

1078

answers:

2

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.

+4  A: 

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
Kev
A: 

Excellent!

This works great for me on Postgresql v8.4 on WinXP. Have been unable to find same library on v8.3 on our Linux server (maybe it was not installed).

Thanks Kev.

Raymond Naseef