I am using Heroku Postgres and want to see what the effect has been of adding some additional indexes to my database.
I am querying pg_stat_user_tables
to see what proportion of queries are using indexes, but I believe that is using statistics from ever since I created the database.
I understand that running SELECT pg_stat_reset();
would reset these statistics, but when I try to run that in the pg:psql console I get the error:
ERROR: must be superuser to reset statistics counters
Is there another way to achieve this with a Heroku Postgres production database?
pg:reset. The PostgreSQL user your database is assigned doesn't have permission to create or drop databases. To drop and recreate your database use pg:reset .
Credentials can be managed from data.heroku.com or from the Heroku CLI. Credentials are available only to production-class plans (Standard, Premium, Private, and Shield). Ineligible plans include only the default credential, which cannot create other credentials or manage permissions.
I found out via a support request today that this has now been added:
heroku plugins:install git://github.com/heroku/heroku-pg-extras.git
heroku pg:stats_reset
How easy is it for you to reproduce the scenarios or tests that will exercise those queries? Could you do the following?
Hopefully you are able to easily create a representative set of data that will let you test your queries more easily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With