The connection pools are keyed from class names.

I was dealing with some "personal" problems in my work app tonight and noticed that the establish_connection method creates pools for the calling class vs the name of the connection in database.yml. My app is rather large and a number of models connect to an alternate database. This means that said connection, if left at the default pool size of 5, will have 5 times the number of models that call that establish_connection to it. In my app that was a pretty hefty number, around 10-15 models.

Is there any interest in reviewing a patch that would change this so that connection pools are keyed off the name of the connection in database.yml? Perhaps another alternative? For now I am thinking of making a base connection class and just having the 10-15 models in my app subclass from that vs ActiveRecord::Base. Feedback very much appreciated.

  - Thanks,      Ken

I should also say that this has very practical issues related to it
too. I'm not totally sure, but I think my issue is related to this.
Case in point, I have 3 models that use my alternate connection. One
model has many of the other with the third as a :through association.
When I push new objects to the association the transaction blocks that
are normally generated by the association code seems to blow up
horribly. My theory at this time is that each models connection pool
is not shared.

On a less practical side, I'd like my 10-15 models that call
establish_connection to my alternate database to not create upwards of
75 connections, just the 5 I have as the pool size in database.yml.
I'd be happy to do a patch if anyone thinks that keying the connection
pools to the named configuration would be a good way of solving this.

  - Ken