Re: Clustering with minimal locking

From: Decibel! <decibel(at)decibel(dot)org>
To: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Clustering with minimal locking
Date: 2008-06-18 03:56:52
Message-ID: 2272DCA5-9AFD-4B51-BBA0-9925E6B7F440@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jun 17, 2008, at 11:37 AM, Scott Ribe wrote:
>> BOOM! Deadlock.
>
> No more likely than with the current cluster command. Acquiring the
> lock is
> the same risk; but it is held for much less time.

Actually, no (at least in 8.2). CLUSTER grabs an exclusive lock
before it does any work meaning that it can't deadlock by itself. Of
course you could always do something like

BEGIN;
SELECT * FROM a;
CLUSTER .. ON a;
COMMIT;

Which does introduce the risk of a deadlock, but that's your fault,
not Postgres.
--
Decibel!, aka Jim C. Nasby, Database Architect decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2008-06-18 04:27:32 Re: Need Help Recovering from Botched Upgrade Attempt
Previous Message Tom Lane 2008-06-18 03:11:27 Re: postgres-devel for 8.3.3