Is it possible to run pgbench on heroku?
- I see here it's a CLI argument (not a postgres command)
- As of nearly 10 years ago, it wasn't a thing. But is it now? https://github.com/heroku/heroku-pg-extras/issues/7
CodePudding user response:
When you connect to your Heroku database using heroku pg:psql
you actually use a psql
running locally on your machine to connect to the remote server.
Similarly, you should be able to use a local pgbench
even though there isn't a Heroku CLI wrapper for it. Retrieve your database connection information using heroku config:get DATABASE_URL
or heroku pg:credentials
, then run the command with the common connection options:
pgbench -h HOST -p 5432 -U USER DATABASE_NAME
Since it is a standard URI, you can pull the hostname, username, password, and port out of Heroku's database URL like so:
postgres://user:password@host:port/database