Add possibility to set connection_pool size #17

wants to merge 1 commit into

5 participants


I added the possibility to set the connection pool size in database.yml using an environment variable "DB_POOL".
When not set, the default (5) is written to the file instead.


You can achieve this by adding a ?pool=5 to your DATABASE_URL

Heroku member

I was going to say what @ddollar said. Any reason this doesn't work for you? @Reprazent?

fdr commented Jun 6, 2012

Asking people to modify their database URIs for Rails seems like a bad idea. This is a recent development for Postgres, but more generally many projects have defined their own URI formats and expecting modified versions to function in any way is not reasonable. The Rails buildpack interpreting URIs in its own special way sounds like a recipe for confusion. Furthermore, sound alterations to the URI when injected from another source may not always be feasible.

I don't know if this is the mechanism you want (but I don't see why not, in broad strokes), but modification of URI to get at this functionality is going to be painful.


@hone the app I'm using this on has multiple environments (with different connection pools), it seemed easier at the time to have a separate env variable to set this.
I also believe this solution might be easier to maintain, like @fdr mentioned.

Heroku member

The issue with this change is the env vars aren't being passed to the buildpack unless the user_env_compile labs feature is used this won't be picked up.

@fdr we don't want to be adding a bunch of env vars to be passed to configure the build process. We did this in bamboo and it was a mess.


As per the Concurrency and Database Connections guide, things like this are probably best handled in an initializer. Can we close this?

Heroku member

Thanks @catsby

@hone hone closed this Jul 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment