On 02/13/2012 02:45 PM, Jeff Davis wrote:
On Mon, 2012-02-13 at 17:30 -0500, Eliot Gable wrote:
Are postgres back end processes connection specific? In other words,
can we assume / trust that they will be terminated and cleaned up when
we close a connection and that they will not live on and be reused by
other connections?
Yes, one backend per connection. When you close the connection, the
backend process should go away.
Under some circumstances, that might not always happen immediately if
the backend is in the middle of doing some work.
Regards,
Jeff Davis
But to amplify on Jeff's comment, he is referring to the actual final
connection to the PostgreSQL server. The OP did not actually specify who
"we" are and what led to the question. An end client completing its work
and need for a connection (or even specifically terminating the
connection) may not actually release and close the connection to the
server for a variety of reasons. PHP persistent connections, Java
connection pooling or one or more layers of external connection pooling
services like pgbouncer are just three common scenarios.
If you suspect a connection is not being closed properly you can run
"select * from pg_stat_activity();" to view current database
connections. To view information about connections from other than the
current user you will need database superuser privileges.
Cheers,
Steve
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general