Skip to content

Commit febf04d

Browse files
authored
Merge pull request DataDog#16072 from DataDog/zach.smith/dbm-troubleshooting-pg-stat-statements-wrong-search-path
[DBM] Update troubleshooting pg_stat_statements not in search_path
2 parents 1ac9793 + e83ff1d commit febf04d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

content/en/database_monitoring/setup_postgres/troubleshooting.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ psql -h localhost -U datadog -d postgres -c "select * from pg_stat_statements LI
9797

9898
If you specified a `dbname` other than the default `postgres` in your Agent config, you must run `CREATE EXTENSION pg_stat_statements` in that database.
9999

100+
If you created the extension in your target database and you still see this warning, the extension may have been created in a schema that is not accessible to the `datadog` user. To verify this, run this command to check which schema `pg_stat_statements` was created in:
101+
102+
```bash
103+
psql -h localhost -U datadog -d postgres -c "select nspname from pg_extension, pg_namespace where extname = 'pg_stat_statements' and pg_extension.extnamespace = pg_namespace.oid;"
104+
```
105+
106+
Then, run this command to check which schemas are visible to the `datadog` user:
107+
108+
```bash
109+
psql -h localhost -U datadog -d <your_database> -c "show search_path;"
110+
```
111+
112+
If you do not see the `pg_stat_statements` schema in the `datadog` user's `search_path`, you need to add it to the `datadog` user. For example:
113+
114+
```sql
115+
ALTER ROLE datadog SET search_path = "$user",public,schema_with_pg_stat_statements;
116+
```
117+
100118
### Certain queries are missing
101119

102120
If you have data from some queries, but do not see a particular query or set of queries in Database Monitoring that you're expecting to see , follow this guide.
@@ -239,4 +257,4 @@ For more information, see the appropriate version of the [Postgres `contrib` doc
239257
[21]: https://www.postgresql.org/docs/14/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW
240258
[22]: https://www.postgresql.org/docs/12/contrib.html
241259
[23]: https://github.com/DataDog/integrations-core/blob/master/postgres/datadog_checks/postgres/data/conf.yaml.example#L281
242-
[24]: https://pkg.go.dev/github.com/jackc/pgx/v4#QuerySimpleProtocol
260+
[24]: https://pkg.go.dev/github.com/jackc/pgx/v4#QuerySimpleProtocol

0 commit comments

Comments
 (0)