RE: User locks code - Mailing list pgsql-hackers

From Mikheev, Vadim
Subject RE: User locks code
Date
Msg-id 3705826352029646A3E91C53F7189E32016746@sectorbase2.sectorbase.com
Whole thread Raw
In response to User locks code  ("Mikheev, Vadim" <vmikheev@SECTORBASE.COM>)
Responses Re: RE: User locks code  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> yep:
> lock "tablename.colname.val=1"
> select count(*) from tablename where colname=1
> If no rows, insert, else update.
> (dunno if the locks would scale to a scenario with hundreds
> of concurrent inserts - how many user locks max?).

I don't see problem here - just a few bytes in shmem for
key. Auxiliary table would keep refcounters for keys.

> Why wouldn't it work with serializable isolevel?

Because of selects see old database snapshot and so you
wouldn't see key inserted+committed by concurrent tx.

Vadim


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Link to bug webpage
Next
From: Vince Vielhaber
Date:
Subject: Re: Link to bug webpage