Issue
I'd like to reset the pg_stats table to measure the performance of database changes.
Resolution
The pg_stat_statements are where Postgres records all kinds of performance information. This gets used in several Heroku commands including pg:diagnose, pg:outliers and pg:long-running-queries.
You can reset the pg_stat_statements directly in a psql console like so: heroku pg:psql <database> -a <app name> -c "SELECT pg_stat_statements_reset();".
Alternatively you can do this in two ways via the CLI:
- with the pg:outliers command:
heroku pg:outliers --reset
- with Heroku PG extras plugin also:
heroku plugins:install heroku-pg-extras
heroku pg:stats-reset -a APP_NAME