How do I grant the `pg_monitor` role to my Heroku Postgres database user?

Issue

I would like to use a monitoring service like Datadog and I need to grant my Heroku Postgres user the pg_monitor role.

Resolution

For production plans, the default credential for Heroku Postgres databases has pg_monitor privileges and it can grant this membership to other credentials/users in the database.

To grant the pg_monitor role to a custom credential, connect to the database with your default credential, and run:

GRANT pg_monitor TO <credential_name>;

When granting the pg_monitor role to a credential it will also inherit the pg_read_all_settings, pg_read_all_stats and pg_stat_scan_tables roles - see "Predefined Roles" in the PostgreSQL documentation.

Note: Due to the multi-tenancy setup of Hobby, Mini, and Basic databases, pg_monitor permissions can't be granted on these plans for security and privacy reasons.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support