Re: [PERFORM] Locking in PostgreSQL?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: Jens Schipkowski <jens(dot)schipkowski(at)apus(dot)co(dot)at>, Joost Kraaijeveld <J(dot)Kraaijeveld(at)askesis(dot)nl>, pgsql-general(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] Locking in PostgreSQL?
Date: 2006-12-06 13:45:27
Message-ID: 20061206134527.GA11211@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

On Wed, Dec 06, 2006 at 08:26:45AM -0500, Dave Cramer wrote:
> >>Unless you specifically ask for it postgresql doesn't lock any
> >>rows when you update data.
> >>
> >Thats not right. UPDATE will force a RowExclusiveLock to rows
> >matching the WHERE clause, or all if no one is specified.
>
> Apparently I've completely misunderstood MVCC then.... My
> understanding is that unless you do a select ... for update then
> update the rows will not be locked .

I think it comes down to what you mean by RowExclusiveLock. In MVCC,
writers don't block readers, so even if someone executes an update on a
row, readers (SELECT statements) will not be blocked.

So it's not a lock as such, more a "I've updated this row, go find the
new version if that's appropriate for your snapshot".

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Leonard Soetedjo 2006-12-06 13:54:28 Re: Error in installing compat-postgresql-libs rpm
Previous Message Markus Schiltknecht 2006-12-06 13:42:32 Re: [PERFORM] Locking in PostgreSQL?

Browse pgsql-performance by date

  From Date Subject
Next Message Brian Wipf 2006-12-06 15:40:55 File Systems Compared
Previous Message Markus Schiltknecht 2006-12-06 13:42:32 Re: [PERFORM] Locking in PostgreSQL?