Sergey Moshkov
Sergey Moshkov

Reputation: 491

NHibernate + Npgsql + PostgreSQL connections pool misunderstanding

I have some misunderstanding of pooling mechanism in NHibernate with Npgsql (PostgreSQL DB).

How does it actually work? I can set 'pooling=true' parameter in DB connection string. On which side pooling will actually be done: NHibernate or PostgreSql? As I know PostgreSql 9.2 does not have its own pool mechanism, how will pooling work in this case? I also can specify 'MinPoolSize' and 'MaxPoolSize' parameters in DB connection string. What are these parameters meaning? When new connection is actually being created (or taken from pool in case 'pooling=true')? When I open a new NHibernate session or it is not depending on opening/closing session?

Upvotes: 0

Views: 1010

Answers (1)

Oskar Berggren
Oskar Berggren

Reputation: 5648

NHibernate does not manage (nor does it really care about) connection pooling. This is a feature of some ADO.Net Providers. Nor would the server necessarily be involved either since any client with enough sophistication can implement its own connection pool. After all, it's only a matter of keeping a number of spare connections open.

I believe this is something implemented in Npgsql.

Upvotes: 1

Related Questions