X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 841C3D1C4BF for ; Fri, 1 Aug 2003 04:38:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 13091-08 for ; Fri, 1 Aug 2003 01:37:15 -0300 (ADT) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by svr1.postgresql.org (Postfix) with ESMTP id 9117ED1C4BD for ; Fri, 1 Aug 2003 01:38:20 -0300 (ADT) Received: from taekwondo.intra.pretax.net (unknown [195.197.242.66]) by gw01.mail.saunalahti.fi (Postfix) with ESMTP id 9370E1A1952; Fri, 1 Aug 2003 07:38:17 +0300 (EEST) Subject: Re: Parallel transactions failing oddly From: Mauri Sahlberg Reply-To: Mauri.Sahlberg@pretax.net To: Stephan Szabo Cc: pgsql-admin@postgresql.org, petri.hilska@pretax.net In-Reply-To: <20030731170748.L29530-100000@megazone.bigpanda.com> References: <20030731170748.L29530-100000@megazone.bigpanda.com> Content-Type: text/plain Organization: Pretax Systems Oy Message-Id: <1059712650.6233.5.camel@taekwondo.intra.pretax.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 01 Aug 2003 07:37:30 +0300 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/14 X-Sequence-Number: 9737 On pe, 2003-08-01 at 03:12, Stephan Szabo wrote: > > interface. If we run them one by one everything goes fine. But if I > > run them in parallel - in separate processes - all but the first one > > claiming the lock for "ryhmalaiset"-table will fail. And they will > > fail as soon as the first one is finished by trying to insert > > duplicate row in the shared table. Incidentally this row would also be > > the very first row they are trying to insert. They all run the same code > > but with different data. > > > The second transaction won't see the row inserted by the first transaction > until it commits (at best). Both transactions can think there are no > matching rows. Umh, but as the "ryhmalaiset" table is locked until the transaction is commited? And what do you mean with "at best"? Is there any way ensuring that the other transactions won't access the table until the first one has finished updating it if the lock is not enough?