Configuring EDB Stat Monitor
Configuring EDB Stat Monitor for your database cluster
To run EDB Stat Monitor (edb_stat_monitor), you need to add it to shared_preload_libraries and create the extension in the database.
In the
postgresql.conffile, addedb_stat_monitorto theshared_preload_librariesparameter:shared_preload_libraries = 'edb_stat_monitor'
Note
If
shared_preload_librarieshas other extensions, then you can addedb_stat_monitorto the list. The order doesn't matter.Restart Postgres.
Configuring EDB Stat Monitor in your database
Create the EDB Stat Monitor extension in your database:
CREATE EXTENSION edb_stat_monitor;
This command allows the extension to start collecting statistics about query execution and for you to view and analyze query performance.
Once the extension has gathered statistics, you can query the
edb_stat_monitorview to analyze query performance. For example:postgres=# SELECT application_name, userid AS user_name, datname AS database_name, substr(query,0, 50) AS query, calls, client_ip FROM edb_stat_monitor; application_name | user_name | database_name | query | calls | client_ip ------------------+-----------+---------------+---------------------------------------------------+-------+----------- psql | mbeena | edb | SELECT application_name, userid::regrole AS user_ | 1 | 127.0.0.1 psql | mbeena | edb | SELECT application_name, userid AS user_name, dat | 3 | 127.0.0.1 psql | mbeena | edb | SELECT application_name, userid AS user_name, dat | 1 | 127.0.0.1 psql | mbeena | edb | SELECT application_name, userid AS user_name, dat | 8 | 127.0.0.1 psql | mbeena | edb | SELECT bucket, substr(query,$1, $2) AS query, cmd | 1 | 127.0.0.1 (5 rows)
See Using EDB Stat Monitor for more information on how to query and analyze the data collected by EDB Stat Monitor.
Additional configuration
You can further configure EDB Stat Monitor by setting parameters in the postgresql.conf file. See EDB Stat Monitor parameters for a list of available parameters and their descriptions.
Could this page be better? Report a problem or suggest an addition!