X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A9A99DC810 for ; Sat, 28 Jan 2006 04:20:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16070-08 for ; Sat, 28 Jan 2006 04:19:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from resmta03.ono.com (smtp.ono.com [62.42.230.12]) by postgresql.org (Postfix) with ESMTP id 632679DC80C for ; Sat, 28 Jan 2006 04:19:56 -0400 (AST) Received: from [192.168.1.100] (84.122.162.147) by resmta03.ono.com (7.2.052) (authenticated as juanmime) id 43C1E4D4001B9B79 for pgsql-admin@postgresql.org; Sat, 28 Jan 2006 09:19:56 +0100 Message-ID: <43DB2942.3040009@ono.com> Date: Sat, 28 Jan 2006 09:20:18 +0100 From: Juan Miguel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: es-es, es MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Postgresql, number of connections and life time Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.672 required=5 tests=[AWL=1.672] X-Spam-Score: 1.672 X-Spam-Level: * X-Archive-Number: 200601/310 X-Sequence-Number: 20398 Hello, First of all sorry about my bad command of english. I have two questions about postgres. First. I have a Linux box with postgres 7.4 branche, where web php applications queries the DB. When Apache launches a php file that connects to the DB, if I do "ps aux | grep postgrest", I can see a process "postgres user ...." running, that represents the session openned to the DB. But when the php program finishes, and closes the connection, this process does not end. Therefore the number of processes are growing while people visit the web. ¿ Why ? I see the php code, and there is a closing command before end. I see that sometimes I visit a page that connects to the DB and no new process is performed or remains. I also realise that after several hours (for example at midnight) those processes don't exist. What is happening ? Is it usual ? Is there a param to control the number of process launched and their life times? In PHP I don't use a pool of connections because, the problem is the same (there are several processes, and remain after connection closes). Second. I gain access this DB remotely by an encrypted connection with stunnel. Well, when I launch a connection to a DB, and passes a long time without traffic, I realise the connection is closed. The program that queries the DB does not realise the connection is broken and when it tries to query, it fails. I think that the origin of the problem is not stunnel, because the same problem presents to me when trying with a testing DB without stunnel. ¿ Why ? Has postgres a timer that breaks the connections when there is no traffic ? Has Linux this timmer ? Is the carrying data enterprise who closes the connection ? Is this a TCP/IP stack protocol question ? Thanks you very much.