Re: limit number of concurrent callers to a stored proc?

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: <pgsql-performance(at)postgresql(dot)org>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: limit number of concurrent callers to a stored proc?
Date: 2005-08-18 19:22:46
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3417DD147@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Christopher
> You could use a 1 column/1 row table perhaps. Use some sort of
locking
> mechanism.
>
> Also, check out contrib/userlock

userlock is definitely the way to go for this type of problem.

The are really the only way to provide locking facilities that live
outside transactions.

You are provided with 48 bits of lock space in the form of offset/block
in 32 bit field and a 16 bit field. The 16 bit field could be the pid
of the locker and the 32 bit field the oid of the function.

Unfortunately, userlocks are not really easy to query via the pg_locks()
view. However this has been addressed for 8.1. In 8.1, it will be
trivial to create a function which checked the number of lockers on the
function oid and acquire a lock if less than a certain amount.

Merlin

Browse pgsql-performance by date

  From Date Subject
Next Message Ron 2005-08-18 19:56:53 Re: extremly low memory usage
Previous Message John Arbash Meinel 2005-08-18 17:55:03 Re: extremly low memory usage