| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера