X-Original-To: pgsql-jdbc@postgresql.org Received: from mail.xythos.com (unknown [206.14.210.116]) by postgresql.org (Postfix) with ESMTP id 57A1A474E53 for ; Mon, 17 Mar 2003 11:10:28 -0500 (EST) Received: from ravms by mail.xythos.com with mail-ok (Exim 3.36 #3) id 18uxFv-00046F-00; Mon, 17 Mar 2003 16:14:31 +0000 Received: from h-66-166-17-184.snvacaid.covad.net ([66.166.17.184] helo=xythos.com) by mail.xythos.com with asmtp (Exim 3.36 #3) id 18uxFv-000464-00; Mon, 17 Mar 2003 16:14:31 +0000 Message-ID: <3E72A5ED.7040608@xythos.com> Date: Fri, 14 Mar 2003 20:02:53 -0800 From: Barry Lind User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alexey Yudichev Cc: pgsql-jdbc@postgresql.org Subject: Re: idle in transaction References: <8BCBF9DB739F034B87FE7C7D30EAE55C15A6CC@hqex2k.francoudi.com> In-Reply-To: <8BCBF9DB739F034B87FE7C7D30EAE55C15A6CC@hqex2k.francoudi.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Envelope-To: Alexey@francoudi.com, pgsql-jdbc@postgresql.org X-Archive-Number: 200303/142 X-Sequence-Number: 6683 Alexey, A transaction being started doesn't prevent you from creating an index. A lock on a table prevents you from creating an index. A select statement will cause locks on the table it selects from and those locks are not released until the transaction is committed. What I suspect is happening in your application (I say this from experience because I needed to do a lot of work in my application to avoid this) is the following: You have code that is getting a connection from your connection pool and using it only for select operations. And because you are only doing selects you are not commiting or rolling back before returning the connection. But because you aren't commiting or rollingback the locks the select aquired are still being held and thus indexes can't be created, vacuum full can't be run, etc. You need to make sure that you always commit/rollback before returning a connection to your connection pool (or make sure your connection pool does that for you). thanks, --Barry Alexey Yudichev wrote: > It seems that connection.commit() commits current transaction and immediately begins a new one so that connection status is always "idle in transaction". During that time no indicies could be created/dropped, no vaccum command can be issued etc because of locks I suppose. > I use PostgreSQL 7.1 and tried 7.2 drivers and 7.3 drivers (with option compatible=7.1). > Is there anything that can be done to allow creating index without restarting the connection pool? > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org >