X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 03170D1B196 for ; Sat, 22 May 2004 03:04:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 89358-03 for ; Sat, 22 May 2004 03:04:14 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A9655D1B19F for ; Sat, 22 May 2004 03:04:12 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4M64CRW006098; Sat, 22 May 2004 02:04:13 -0400 (EDT) To: "David F. Skoll" Cc: pgsql-admin@postgresql.org Subject: Re: Exponential behaviour with UPDATE collisions? In-reply-to: References: Comments: In-reply-to "David F. Skoll" message dated "Thu, 20 May 2004 15:31:19 -0400" Date: Sat, 22 May 2004 02:04:12 -0400 Message-ID: <6097.1085205852@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/239 X-Sequence-Number: 13555 "David F. Skoll" writes: > I would expect that if N clients are all trying to update the same row, > that the N updates would be serialized and run in O(N) time. Possibly so; but your test case isn't a pure illustration of an O(N) situation. You are measuring the time for the mainline to run 50 updates of a row (as fast as it can) while N other processes are updating the same row as fast as they can. The run will presumably generate somewhere around N*50 dead rows with the same key. Since you're not doing any vacuums meanwhile, later updates will have to scan through lots of dead rows looking for the one live row. In other words, there's an O(N^2) behavior here that would occur without any parallelism at all, just from the number of dead rows you're leaving behind. > Is this the expected behaviour? Is it considered a problem? It's the price we pay for MVCC semantics. If you have an application in which the bottleneck is the number of updates that can be done on a single row, you might be better off with a non-MVCC database. regards, tom lane