Re: how to make an 'UNLOCK'?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: how to make an 'UNLOCK'?
Дата
Msg-id 485.1038674697@sss.pgh.pa.us
обсуждение исходный текст
Ответ на how to make an 'UNLOCK'?  ("Grand Titus" <grand.titus@free.fr>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: how to get argument number
Следующее
От: Tom Lane
Дата:
Сообщение: Re: vacuum full analyze problem