DBA Hub

📋Steps in this guide1/1

Find query execution time using pg_stat_statement

-- Monitor query execution time

postgresql configurationintermediate
by PostgreSQL
11 views
1

Find query execution time using pg_stat_statement

-- Monitor query execution time NOTE: If pg_stat_statements is not available in your database, then activate using below: -- Add below parameters in postgres.conf file and restart the postgres cluster -- Now create extension:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
select substr(query,1,100) query,calls,min_time/1000 "min_time(in sec)" , max_time/1000 "max_time(in sec)", mean_time/1000 "avg_time(in sec)", rows from pg_stat_statements order by mean_time desc;
-------------------------------------------------------------------------------------------------------------------------------------------------------
shared_preload_libraries = 'pg_stat_statements'
pg_stat_statements.track = all
sudo service postgresql restart
dbaclass=#
create extension pg_stat_statements;
CREATE EXTENSION

Comments (0)

Please to add comments

No comments yet. Be the first to comment!