From: | Erik Jones <erik(at)myemma(dot)com> |
---|---|
To: | andy <andy(at)squeakycode(dot)net> |
Cc: | Adam Rich <adam(dot)r(at)indigodynamic(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Locking & concurrency - best practices |
Date: | 2008-01-14 22:06:45 |
Message-ID: | A5CE8F78-0F69-46EE-B1E4-C194CE7C2223@myemma.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Jan 14, 2008, at 3:54 PM, andy wrote:
> In our program we wrote the locking into the program, and created a
> modulelock table like:
>
> create table moduelock(
> userid int,
> module int,
> primary key (userid, module)
> )
>
> The program then locks things before it uses them... but we also
> have pretty low contention for modules.
>
> A lock is:
> begin
> insert into modulelock...
> commit;
>
> if commit ok, then go ahead. When we are done, delete from
> modulelock where ...
From what I can tell, this kind of roll-your-own application level
locking system is exactly what advisory locks are for. Search the
archives for the last couple of weeks as I remember someone posting
some really helpful functions to assist in using advisory locks.
Erik Jones
DBA | Emma®
erik(at)myemma(dot)com
800.595.4401 or 615.292.5888
615.292.0777 (fax)
Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com
From | Date | Subject | |
---|---|---|---|
Next Message | Adam Rich | 2008-01-14 22:57:43 | Re: Locking & concurrency - best practices |
Previous Message | andy | 2008-01-14 21:54:19 | Re: Locking & concurrency - best practices |