View statistics_top_ten_memory_usage_queries
Top ten queries with high memory usage.
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. |
| memory_hit_dirty | bigint | This the sum of shared_blks_hit + s.shared_blks_dirtied, the calculated memory usage in byte. |
Example
SELECT *
FROM statistics_top_ten_memory_usage_queries;
| rolename | database_name | query | memory_hit_dirty |
|---|---|---|---|
| stefanie | domotz | CALL _timescaledb_functions.policy_compression_execute( job_id, htid, lag_value::INTERVAL, maxchunks, verbose_log, recompress_enabled, use_creation_time, hypercore_use_access_method ) | 28854 |
| stefanie | stefanie | WITH test AS ( SELECT count(*) as key_count , $1 AS zero FROM pg_functions ) SELECT CASE WHEN key_count >= $2 THEN $3 ELSE ($4 / zero)::BOOLEAN END AS res FROM test | 20939 |