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.

  1. In the postgresql.conf file, add edb_stat_monitor to the shared_preload_libraries parameter:

    shared_preload_libraries = 'edb_stat_monitor'
    Note

    If shared_preload_libraries has other extensions, then you can add edb_stat_monitor to the list. The order doesn't matter.

  2. Restart Postgres.

Configuring EDB Stat Monitor in your database

  1. Create the EDB Stat Monitor extension in your database:

    CREATE EXTENSION edb_stat_monitor;

    This allows the extension to start collecting statistics about query execution and for you to view and analyze query performance.

  2. Once the extension has gathered statistics, you can query the edb_stat_monitor view 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 the Using EDB Stat Monitor documentation 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 various parameters in the postgresql.conf file. See the EDB Stat Monitor Parameters documentation for a list of available parameters and their descriptions.


Could this page be better? Report a problem or suggest an addition!