Skip to content

Commit

Permalink
Exclude EXPLAIN queries from pg_stat_statements (#9358)
Browse files Browse the repository at this point in the history
* postgres exclude EXPLAIN queries from pg_stat_statements

Update the collection of postgres query metrics to exclude `EXPLAIN` queries.

If deep database monitoring is enabled and we are collecting execution plans, then there will be at least one tracked EXPLAIN statement for every unique normalized query we encounter. Since these statements are not used in the product we exclude them from collection.

This updates postgres to have the same behavior as mysql, where we do the same exclusion for query metrics.

* escape
  • Loading branch information
djova committed May 17, 2021
1 parent a8c2e9e commit 2c6a9c5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions postgres/datadog_checks/postgres/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
LEFT JOIN pg_database
ON pg_stat_statements.dbid = pg_database.oid
WHERE query != '<insufficient privilege>'
AND query NOT LIKE 'EXPLAIN %%'
{filters}
LIMIT {limit}
"""
Expand Down

0 comments on commit 2c6a9c5

Please sign in to comment.