Como faço para ativar a função profiler PostgreSQL?

votos
12

Isso me levou um tempo para descobrir e eu encontrei a resposta em uma wiki em língua estrangeira um número de semanas atrás, e ele foi muito útil, então eu pensei que eu iria partilhar.

Publicado 10/01/2009 em 00:27
fonte usuário
Em outras línguas...                            


1 respostas

votos
9

No PostgreSQL 8.3 em Win32, o plugin de perfil é instalado por padrão, mas não carregado. Apenas executar esse SQL:

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

... e então quando você deseja criar um perfil de algum código,

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
Respondeu 10/01/2009 em 00:31
fonte usuário

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more