View statistics_top_ten_time_consuming_queries

Top ten time consuming queries.

COUTION

The schema where the extension pg_stat_statements is installed has to be in the search_path of the user!

This view needs pg_stat_statements to be installed. When the extension is not installed, the view will not be installed by the extension.

Columns

Column Name datatype Description
rolename regrole The role/user who executed the query.
database_name name The database name in which the query has been executed.
query text This is the SQL source of the query.
calls bigint The number of times the statement was executed.
total_time_seconds double precision The total execution time in seconds.
min_time_seconds double precision The minimum execution time in seconds.
max_time_seconds double precision The maximum execution time in seconds.
mean_time_seconds double precision The average execution time of the query in seconds

Example

SELECT *
FROM statistics_top_ten_time_consuming_queries;
rolename database_name query calls total_time_seconds min_time_seconds max_time_seconds mean_time_seconds
stefanie stefanie SELECT * FROM pg_table_bloat 1 0.251402028 0.251402028 0.251402028 0.251402028
stefanie stefanie SELECT t.oid,t.*,c.relkind,format_type(nullif(t.typbasetype, $1), t.typtypmod) as base_type_name, d.description
FROM pg_catalog.pg_type t
LEFT OUTER JOIN pg_catalog.pg_class c ON c.oid=t.typrelid
LEFT OUTER JOIN pg_catalog.pg_description d ON t.oid=d.objoid
WHERE t.typname IS NOT NULL
2 0.050862167 0.016468966 0.034393201 0.0254310835