From: Tom Lane <tgl@sss.pgh.pa.us>
To: David F. Skoll <dfs@roaringpenguin.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Exponential behaviour with UPDATE collisions?
Date: Sat, 22 May 2004 02:04:12 -0400
Message-ID: <6097.1085205852@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.58.0405201523040.6006@shishi.roaringpenguin.com>
References: <Pine.LNX.4.58.0405201523040.6006@shishi.roaringpenguin.com>
"David F. Skoll" <dfs@roaringpenguin.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, dfs@roaringpenguin.com
Subject: Re: Exponential behaviour with UPDATE collisions?
In-Reply-To: <6097.1085205852@sss.pgh.pa.us>
References: <Pine.LNX.4.58.0405201523040.6006@shishi.roaringpenguin.com> <6097.1085205852@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox