Scott Marlowe wrote:
The serial based approach sounds a fair bit better.
Er, I meant "sequence".
Add prepared select statements and you'd get get pretty fast
performance.
Yep, and if DB round trips are a problem it can always be wrapped up in
a stored procedure. I'd be tempted to do
Scott Marlowe wrote:
Sure, but you have to trap that all the time. The solution using a
cycling sequence keeps you from ever seeing that (unless you managed
to check out all 9,999 other values while still getting the current
one. No locking needed, dozens of updaters running concurrently and
no
On Thu, Apr 3, 2008 at 12:58 PM, Craig Ringer
<[EMAIL PROTECTED]> wrote:
> Scott Marlowe wrote:
>
> > Sure, but you have to trap that all the time. The solution using a
> > cycling sequence keeps you from ever seeing that (unless you managed
> > to check out all 9,999 other values while still gett
Scott Marlowe wrote:
> On Thu, Apr 3, 2008 at 11:45 AM, Craig Ringer
> <[EMAIL PROTECTED]> wrote:
>> rihad wrote:
>> > Given this type query:
>> >
>> > UPDATE bw_pool
>> > SET user_id=?
>> > WHERE bw_id=
>> > (SELECT MIN(bw_id) FROM bw_pool WHERE user_i
On Thu, Apr 3, 2008 at 11:45 AM, Craig Ringer
<[EMAIL PROTECTED]> wrote:
> rihad wrote:
> > Given this type query:
> >
> > UPDATE bw_pool
> > SET user_id=?
> > WHERE bw_id=
> > (SELECT MIN(bw_id) FROM bw_pool WHERE user_id IS NULL)
> > RETURNIN
On Thu, Apr 03, 2008 at 09:44:55PM +0500, rihad wrote:
> Given this type query:
>
> UPDATE bw_pool
> SET user_id=?
> WHERE bw_id=
> (SELECT MIN(bw_id) FROM bw_pool WHERE user_id IS NULL)
> RETURNING bw_id
>
> The idea is to "single-threadedly" get a
On Thu, Apr 3, 2008 at 11:42 AM, Scott Marlowe <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 3, 2008 at 11:32 AM, rihad <[EMAIL PROTECTED]> wrote:
> > Scott Marlowe wrote:
> >
> > > On Thu, Apr 3, 2008 at 10:44 AM, rihad <[EMAIL PROTECTED]> wrote:
> > >
> > > > Given this type query:
> > > >
> >
rihad wrote:
> Given this type query:
>
> UPDATE bw_pool
> SET user_id=?
> WHERE bw_id=
> (SELECT MIN(bw_id) FROM bw_pool WHERE user_id IS NULL)
> RETURNING bw_id
Can you use a SERIALIZABLE transaction and avoid the explicit lock?
If I'm not mistak
On Thu, Apr 3, 2008 at 11:32 AM, rihad <[EMAIL PROTECTED]> wrote:
> Scott Marlowe wrote:
>
> > On Thu, Apr 3, 2008 at 10:44 AM, rihad <[EMAIL PROTECTED]> wrote:
> >
> > > Given this type query:
> > >
> > >UPDATE bw_pool
> > >SET user_id=?
> > >WHERE bw_id=
> > >
Scott Marlowe wrote:
On Thu, Apr 3, 2008 at 10:44 AM, rihad <[EMAIL PROTECTED]> wrote:
Given this type query:
UPDATE bw_pool
SET user_id=?
WHERE bw_id=
(SELECT MIN(bw_id) FROM bw_pool WHERE user_id IS NULL)
RETURNING bw_id
The idea is to "single
On Thu, Apr 3, 2008 at 10:44 AM, rihad <[EMAIL PROTECTED]> wrote:
> Given this type query:
>
> UPDATE bw_pool
> SET user_id=?
> WHERE bw_id=
> (SELECT MIN(bw_id) FROM bw_pool WHERE user_id IS NULL)
> RETURNING bw_id
>
> The idea is to "single-threade
Given this type query:
UPDATE bw_pool
SET user_id=?
WHERE bw_id=
(SELECT MIN(bw_id) FROM bw_pool WHERE user_id IS NULL)
RETURNING bw_id
The idea is to "single-threadedly" get at the next available empty slot,
no matter how many such queries run in
12 matches
Mail list logo