Re: Proposal: String key space for advisory locks
От | Christophe Pettus |
---|---|
Тема | Re: Proposal: String key space for advisory locks |
Дата | |
Msg-id | 319C476D-A365-4BF0-94CA-1CDC078529B9@thebuild.com обсуждение исходный текст |
Ответ на | Re: Proposal: String key space for advisory locks (Merlin Moncure <mmoncure@gmail.com>) |
Список | pgsql-hackers |
On Oct 27, 2009, at 4:37 PM, Merlin Moncure wrote: > 'as is', advisory locks is a fantastic feature that can be used for > signaling, mutexing, etc that are relatively difficult things to do in > the transactional world of sql. My main gripe is that the 'shared id' > method for doing record pessimistic locks is basically a nuclear > missile pointed at your shared buffers if you don't have lot of > discipline in the queries that lock IDs. Maybe this argues for more > of a 'sql exposed' pessimistic lock feature that operates on similar > level as 'for update'...I'm not sure...curious what thoughts you have > about improving them. Advisory locks have, as you say, a raft of very useful characteristics: 1. Enforced as much or as little as you wish, depending on your application design. 2. Race-condition-free. 3. Cleaned up automatically on session end. Of course, 2^64 potential entries are enough for anyone. The usability issue comes when you have multiple domains that you want to apply advisory locks to in a single database. For example, if you have multiple tables (one of which, just for example, has a character pk), and perhaps some inter-client mutex signaling for things that are outside of a transactional model ("this client is importing a file from an outside source, so don't you do it"), it's unappealing to have to come up with ways of representing those in a 64-bit namespace. Hashing isn't a terrible solution, assuming collisions don't become an issue; a well-designed hashtext64() would help a lot. -- -- Christophe Pettus xof@thebuild.com
В списке pgsql-hackers по дате отправления: