Once Heroku support showed us how to specify the Postgres version for in-dyno Postgres in our app.json we re-ran our Rspec rspecs and were pleasantly surprised how fast they ran. (Specifying Postgres 9.6 seems to be required for Rspec for a Rails 4.2.11 app; using the default Postgres 10 causes errors related to the change of the increment_by field in P 10)
Mac OS X | Heroku CI "M" dyno | Heroku CI "M" dyno IN-DYNO postgres | Heroku CI "L" dyno | Heroku CI "L" dyno IN-DYNO postgres |
|
---|---|---|---|---|---|
Dyno cost/hour | $0.34 | $0.34 | $0.68 | $0.68 | |
Run Time | 5:53 | 59:00 | 13:27 !!! | 31:43 | 8:03 !!! |
Heroku cost | $ 0.34 | $ 0.08 | $0.36 | $0.09 |
The “trick” to specifying the Postgres version for in-dyno Postgres is to use an environment variable. If this is documented anywhere we could not find it, so perhaps this will be helpful to someone else:
In order to change the Postgres version for the in-dyno add-on you’ll need to create a new environment variable in your app.json like this:
“environments”: {
“test”: {
“addons”: [“heroku-postgresql:in-dyno”],
“env”: {
“POSTGRESQL_VERSION”: {
“value”: “9.6”
}
}
}
}
}