View statistics_top_ten_query_average_time_in_seconds
Top ten queries with statistics about Top ten queries with high i/o activity.
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. |
| mean_time_seconds | double precision | The average execution time of the query in seconds |
Example
SELECT *
FROM statistics_top_ten_query_average_time_in_seconds;
| rolename | database_name | query | mean_time_seconds |
|---|---|---|---|
| stefanie | stefanie | SELECT i.*,c.relnamespace FROM pg_catalog.pg_inherits i,pg_catalog.pg_class c WHERE i.inhrelid=$1 AND c.oid=i.inhparent ORDER BY i.inhseqno | 0.000009706 |
| stefanie | stefanie | WITH test AS ( SELECT COUNT(*) AS exist , $1 AS zero FROM pg_catalog.pg_views WHERE viewname = $2 ) SELECT CASE WHEN test.exist >= $3 THEN $4 ELSE> ($5 / zero)::BOOLEAN END AS res FROM test | 0.000034866 |