PostgreSQL
 sql >> Datenbank >  >> RDS >> PostgreSQL

Wie aktiviere ich den PostgreSQL-Funktionsprofiler?

Auf PostgreSQL 8.3 unter Win32 wird das Profilerstellungs-Plugin standardmäßig installiert, aber nicht geladen. Führen Sie einfach dieses SQL aus:

LOAD '$libdir/plugins/plugin_profiler.dll';
SET plpgsql.profiler_tablename = 'bazzybar';

...und dann, wenn Sie einen Code profilieren möchten,

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