pg_advisory_lock locks an application-defined resource,
which can be identified either by a single 64-bit key value or two 32-bit key
values (note that these two key spaces do not overlap). If another session
already holds a lock on the same resource identifier, this function will wait
until the resource becomes available. The lock is exclusive. Multiple lock
requests stack, so that if the same resource is locked three times it must then
be unlocked three times to be released for other sessions' use.
pg_advisory_lock_shared works the same as pg_advisory_lock,
except the lock can be shared with other sessions requesting shared locks. Only
would-be exclusive lockers are locked out.
pg_try_advisory_lock is similar to pg_advisory_lock, except
the function will not wait for the lock to become available. It will either
obtain the lock immediately and return true, or return false if the lock cannot
be acquired immediately.
pg_try_advisory_lock_shared works the same as
pg_try_advisory_lock, except it attempts to acquire a shared rather than an
exclusive lock.
pg_advisory_unlock will release a previously-acquired
exclusive session level advisory lock. It returns true if the lock is successfully
released. If the lock was not held, it will return false, and in addition, an
SQL warning will be reported by the server.
pg_advisory_unlock_shared works the same as
pg_advisory_unlock, except it releases a shared session level advisory lock.
pg_advisory_unlock_all will release all session level
advisory locks held by the current session. (This function is implicitly
invoked at session end, even if the client disconnects ungracefully.)
pg_advisory_xact_lock works the same as pg_advisory_lock, except
the lock is automatically released at the end of the current transaction and
cannot be released explicitly.
pg_advisory_xact_lock_shared works the same as
pg_advisory_lock_shared, except the lock is automatically released at the end
of the current transaction and cannot be released explicitly.
pg_try_advisory_xact_lock works the same as
pg_try_advisory_lock, except the lock, if acquired, is automatically released
at the end of the current transaction and cannot be released explicitly.
pg_try_advisory_xact_lock_shared works the same as
pg_try_advisory_lock_shared, except the lock, if acquired, is automatically
released at the end of the current transaction and cannot be released
explicitly.
No comments:
Post a Comment