Re: how to make an 'UNLOCK'? - Mailing list pgsql-general

From Tom Lane
Subject Re: how to make an 'UNLOCK'?
Date
Msg-id 485.1038674697@sss.pgh.pa.us
Whole thread Raw
In response to how to make an 'UNLOCK'?  ("Grand Titus" <grand.titus@free.fr>)
List pgsql-general
"Grand Titus" <grand.titus@free.fr> writes:
>  And I don't know how to unlock a table, I can't find the command 'UNLOCK'.

There is no UNLOCK short of committing your transaction.  If you had
one, your code would not work anyway (because you'd be unlocking the
table before the next guy could see your uncommitted updates).

I'd suggest using an optimistic-locking approach instead: don't lock
at all, just rely on unique indexes to prevent duplicate insertions.
Once in a while you will get a collision, and then you'll have to
roll back your transaction and try again --- but if that only seldom
happens, it's a lot faster than locking every time.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: how to get argument number
Next
From: Tom Lane
Date:
Subject: Re: vacuum full analyze problem