Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 356BF9FBAAA for ; Tue, 6 Mar 2007 13:48:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 64146-02-2 for ; Tue, 6 Mar 2007 13:48:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.net-domino.com (mail.mochima.com [74.208.11.96]) by postgresql.org (Postfix) with ESMTP id 839339FBA7E for ; Tue, 6 Mar 2007 13:48:03 -0400 (AST) Received: from [127.0.0.1] (u15245314.onlinehome-server.com [74.208.11.96]) by mail.net-domino.com (8.13.7/8.13.6) with ESMTP id l26HlYJ0012601 for ; Tue, 6 Mar 2007 13:47:50 -0400 Message-ID: <45EDAAE4.7000500@mochima.com> Date: Tue, 06 Mar 2007 12:54:44 -0500 From: Carlos Moreno User-Agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Insert performance References: <1172596221.393824.41130@j27g2000cwj.googlegroups.com> <45ED1996.7050008@archonet.com> <1173167607.4917.8.camel@hatman> <45ED217D.30404@archonet.com> <1173172748.4917.23.camel@hatman> <45ED37D1.3000503@archonet.com> <45ED8EFD.5030908@mochima.com> <1173196944.9058.25.camel@coppola.muc.ecircle.de> In-Reply-To: <1173196944.9058.25.camel@coppola.muc.ecircle.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Added-Header: Sample_milter accepted message X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=BAYES_50, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200703/139 X-Sequence-Number: 23544 Csaba Nagy wrote: >I only know to answer your no. 2: > > >>2) What about the issue with excessive locking for foreign keys when >>inside a transaction? Has that issue disappeared in 8.2? And if not, >>would it affect similarly in the case of multiple-row inserts? >> >> > >The exclusive lock is gone already starting with 8.0 IIRC, a >non-exclusive lock on the parent row is used instead. Thing is that this >is still too strong ;-) > >The proper lock would be one which only prevents modification of the >parent key, other updates would be safe on the same row. > >In any case, the current behavior is much better than what was before. > > *Much* better, I would say --- though you're still correct in that it is still not the right thing to do. In particular, with the previous approach. there was a serious performance hit when concurrent transactions reference the same keys --- that is, after having taken measures to avoid deadlocks, some transactions would have to *wait* (for no good reason) until the other transaction is completed and the exclusive-access lock is released. For high-traffic databases this can be a quite severe performance hit. I'm glad it has been fixed, even if only partially. Thanks, Carlos --