Advanced Configuration for Postgres Database Monitoring

Advanced Configuration for Postgres Database Monitoring

Database Monitoring is not supported for this site.

Handling many relations

If your Postgres database has a large number of relations (in the thousands), Datadog recommends adding collect_database_size_metrics: false to your instance configuration for that database. When this setting is disabled, the Agent will not run the function pg_database_size() to collect database size statistics, which has worse performance on instances with a large number of tables.

instances:
  - dbm: true
    ...
    collect_database_size_metrics: false

Additionally, if you partition your data across tables, such that table definitions are identical except for the name, this can result in a large number or normalized queries:

SELECT * FROM daily_aggregates_001
SELECT * FROM daily_aggregates_002
SELECT * FROM daily_aggregates_003

In these cases, track these queries as a single normalized query using the quantize_sql_tables option, so all metrics for those queries are rolled up into a single query:

SELECT * FROM daily_aggregates_?

Add the quantize_sql_tables option to your database instance configuration in the Datadog Agent:

instances:
  - dbm: true
    ...
    quantize_sql_tables: true