Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile plpgsql function in PostgreSQL 9.2

I'd like to find the bottlenecks in a plpgsql function, so I'm looking for a profiler.

How do I enable the PostgreSQL function profiler? suggests loading the plugin_profiler.dll library, but it was written for 8.3 and there seems to be no such thing in 9.2

I've also installed and the debugger described at http://git.postgresql.org/gitweb/?p=pldebugger.git;a=summary (which is included with 9.2), but can't see any way of using it as a profiler.

The simple "RAISE NOTICE" method wouldn't be effective for me, because the function executes in < 0.1 ms, but is called many times.

like image 581
EM0 Avatar asked Mar 13 '26 16:03

EM0


1 Answers

PostgreSQL 9.2 has buildin SQL profiler, try to use it - if your plpgsql contains some SQL queries.

http://www.postgresql.org/docs/9.2/static/pgstatstatements.html

and now, plpgsql_check has integrated profiler

like image 85
Pavel Stehule Avatar answered Mar 16 '26 14:03

Pavel Stehule



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!