On Apr 25, 2009, at 5:59 AM, Martin Defeche wrote:
> I'm working on three different programs that all uses the same
> database and
> have to run concurrently. In one of them I'm using 3 thread and I
> use 2
> connections for each threads. The other programs use 3 connections.
The only way to require more than one connection per thread is if each
thread can process multiple overlapping queries. It's better to
finish with one query per thread before starting a new one, requiring
just one connection per thread at most. Processing multiple queries
at once from a single thread ties up more resources on both sides of
the connection.
> Sould I use the connection pool for the program using 6 connection
> or using
> 9 connections is not too big ?
As it says in the user manual, the connection pool works better than a
connection per thread when you can't guarantee that a given thread
will execute queries often enough to avoid server timeout problems.
This can either be because some threads don't require constant access
to a database connection, or because there can be long idle times in
the application.