Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E774B4773FB for ; Fri, 4 Oct 2002 10:38:06 -0400 (EDT) Received: from mail-relay.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 71E99477411 for ; Fri, 4 Oct 2002 10:34:46 -0400 (EDT) Received: (qmail 10351 invoked from network); 4 Oct 2002 14:24:52 -0000 Received: from news1.trade-india.com (HELO www.trade-india.com) (130.94.20.27) by infocom-236-129-del.trade-india.com with SMTP; 4 Oct 2002 14:24:52 -0000 Received: (qmail 16754 invoked by uid 99); 4 Oct 2002 14:34:37 -0000 Received: from 203.145.129.3 (proxying for 203.145.130.142) (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Fri, 4 Oct 2002 20:04:37 +0530 (IST) Message-ID: <57630.203.145.129.3.1033742077.squirrel@mail.trade-india.com> Date: Fri, 4 Oct 2002 20:04:37 +0530 (IST) Subject: Re: idle in transaction with mod_perl From: To: In-Reply-To: <200209300303.g8U333D28908@minos.iwerx.gr> References: <200209300303.g8U333D28908@minos.iwerx.gr> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: X-Mailer: SquirrelMail (version 1.2.6) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/22 X-Sequence-Number: 5880 Hey Kotis! I too use mod_perl + postgresql its perfectly ok to have "idle in transaction..." Becoz as soon as DBI -> commits a given transaction the mod_perl process starts a new transaction. the $dbhs' are in a perpetual transaction mode. I gues you must have done DBI->{AutoCommit} = 0 for that to happen. the persistant connections makes all the difference. One advise : please upgrade to postgresql 7.2.2 Regds Mallah. > Hi all. > > Let me start by saying that I've been using postgres 7.1.3 since it came out and have found it > to be rock solid and simply wonderful! :-) > I particularly like the unlimited size varchars which I was waiting like crazy for. ( actually > i think they came out in a previous release which i missed) > > Also for all anoraks out there let me say that performance wise the thing kicks ass! I've been > using it on linux in a dual 1.2Ghz AMD box with SCSI as a web crawler database with up to 30 > crawlers hammering two tables simultaneously, without a glitch. (a table has over 4,000,000 > records and still holds fine) > > Anyway, sorry for the long intro. Back to the point. > > I've a got a production machine running the above version of pg with mod_perl > (with standard DBI v1.13, not the Apache flavor) accessing a database and > i'm getting some idle connections that make me worry. > > postgres 28252 0.0 0.2 6832 3708 ? S 02:59 0:00 postgres: nobody mydbname > [local] idle in transaction > > I can appreciate them being "idle" but why would they be in a "transaction"? > > I've checked all my code and found that it always does a rollback or a commit after each > INSERT/UPDATE SQL statement. Further to this I am very-very sure that statement handles for > SELECTs are always "finished" ($sth->finish) once I'm done reading rows from them. ( I spent > hours verifying this) > > To make things simpler, I tested a senario where the only staments issued where SELECTs. But > the idle connections still come up (ps -auwwx|grep postg) as being in a transaction. > > So what's going on? > > I read a post by another guy that had a similar problem and found out that SELECT statements > can also be considered as transactions which is fine. > > In a desperate attempt to make things as tidy as possible I even went as far as always calling > rollback at the end of the script just to try and clear whatever it is that is in transaction > but nope.... they're still there. > > When I run psql and execute a couple of statements through it and then leave in peace, the > connection becomes idle but not in a transaction, which sort of gives me a warm feeling > inside. Can I achieve this in my situation? > > Any help, solutions, suggestions? > Should I be worried in eirher case? > Can the "idle in transaction" connections turn sour and corrupt my DB or worst still bring > down my server? > > I appreciate any help. > > Thanks, > Kostis > > ---------------------------(end of broadcast)--------------------------- TIP 6: Have you > searched our list archives? > > http://archives.postgresql.org ----------------------------------------- Get your free web based email at trade-india.com. "India's Leading B2B eMarketplace.!" http://www.trade-india.com/