Datadog Database Monitoring Fundamentals free question 3 / 10 · Domain 2: Database Monitoring (DBM) Configuration and Setup
Which Postgres parameter must be set in postgresql.conf, followed by a server restart, to get the postgresql.queries. metrics?
- track_activity_query_size set to 4096 for larger statements
- shared_preload_libraries set to pg_stat_statements
- pg_stat_statements.track_utility set to off for utility commands
- track_io_timing set to on for the whole server
Show the answer and explanation
Answer: B
Why this is correct
The Required parameters table lists shared_preload_libraries with the value pg_stat_statements. Its description says it is required for postgresql.queries. metrics and that it enables collection of query metrics through the pg_stat_statements extension. The parameters are set in postgresql.conf and the server is restarted for them to take effect.
Why the other options are wrong
"track_io_timing set to on for the whole server" … track_io_timing is an optional parameter that adds block read and write times. It is not what produces the query metrics.
"pg_stat_statements.track_utility set to off for utility commands" … This optional parameter controls whether commands like PREPARE and EXPLAIN are tracked. It does not load the extension.
"track_activity_query_size set to 4096 for larger statements" … This required parameter raises the size of the SQL text that the Agent can see. The query metrics depend on pg_stat_statements being loaded.
Key points
The second required parameter is track_activity_query_size at 4096. Optional parameters tune what is tracked. A missing pg_stat_statements is the first thing to check when query metrics are absent. Because shared_preload_libraries is read at server start, a reload of the configuration is not enough and the restart is part of the step. The documentation puts it this way: "shared_preload_libraries pg_stat_statements Required for postgresql.queries. metrics."