Search Postgresql Archives

Advisory transaction lock for 128-bit space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.
My application need to set advisory lock on UUID key, almost like it
does pg_advisory_xact_lock function. The problem is argument type of
this function - it consumes 8-byte value, not 16-byte.

I can not lock on any(hi, low or middle) 8-byte part of UUID, as far
as it can produce unexpected deadlock issues, because locking on some
ID in this way will imply locking on more "wide" set of ID then I
requested.

Now I am doing the 'trick' using indexing insert/delete, e.g.:
INSERT INTO table_with_uuid_pk(locking_value);
DELETE FROM table_with_uuid_pk WHERE <inserted_row_above>;

It works, but I did not found any description of such 'feature' of
indexes. Can u, please, help to solve this synchronization issue, and
comment the way I am dealing with it now(with index locking)

P.S. The most significant fear I know have, is that currently used
method suffers with same problem as locking for part of UUID - doest
insert/delete really locks only on the value i passed to it?

-- 
Regards,
Andrey

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux