Can I log all queries that run on my Heroku Postgres database?


Heroku Postgres now allows the log level to be configured via Postgres settings

Please note the all setting is generally only intended for debugging purposes, as it can quickly cause significant performance issues for production databases.

If you're trying to identify specific long-running queries, we already log all queries that run longer than 2 seconds. You can also view your most expensive queries at, which is usually a better place to start for optimizing performance.

Finally, you can connect to your database by running heroku pg:psql on the command line and run queries directly there. You can put EXPLAIN ANALYZE in front of the query to get detailed performance information, and paste the output into to understand a specific query.