From 2c6a9c5566312b7ee3ea12eb6eeeb4e486395140 Mon Sep 17 00:00:00 2001 From: Dusan Jovanovic Date: Mon, 17 May 2021 19:02:39 -0400 Subject: [PATCH] Exclude `EXPLAIN` queries from `pg_stat_statements` (#9358) * 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 --- postgres/datadog_checks/postgres/statements.py | 1 + 1 file changed, 1 insertion(+) diff --git a/postgres/datadog_checks/postgres/statements.py b/postgres/datadog_checks/postgres/statements.py index 29b58a127db4e..b9f7346a76929 100644 --- a/postgres/datadog_checks/postgres/statements.py +++ b/postgres/datadog_checks/postgres/statements.py @@ -28,6 +28,7 @@ LEFT JOIN pg_database ON pg_stat_statements.dbid = pg_database.oid WHERE query != '' + AND query NOT LIKE 'EXPLAIN %%' {filters} LIMIT {limit} """