Re: Transaction settings: nowait

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Transaction settings: nowait
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C202FF65AB@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на Transaction settings: nowait  (durumdara <durumdara@gmail.com>)
Ответы Re: Transaction settings: nowait  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
durumdara wrote:
> In FireBird the transactions have these settings:
>
>
> SET TRANSACTION
>    [NAME hostvar]
>    [READ WRITE | READ ONLY]
>    [ [ISOLATION LEVEL] { SNAPSHOT [TABLE STABILITY]
>                          | READ COMMITTED [[NO] RECORD_VERSION] } ]
>    [WAIT | NO WAIT]
>    [LOCK TIMEOUT seconds]
> And this is the important thing:
>
>
> [WAIT | NO WAIT]
>    [LOCK TIMEOUT seconds]
> If set wait and timeout, the Firebird is waiting for the
> locked resource (record) for X seconds before it show deadlock error.
>
> But when you set no wait, the deadlock error immediately
> shown by the server.
>
> I wanna ask that if I want to avoid the full deadlocks.
>
> For. example: I forget to make commit, or rollback on
> exception then all resources I used (updated) is locked.
>
> If I use nowait, the clients immediately get the error
> message, and they are are not sitting deafly and blindly
> before the screen, waiting for what will happen.
>
> So: have PGSQL same mechanism like nowait?

I assume that you mean "locks" when you write "deadlocks".

There is no exact equivalent, but you can set the variable
statement_timeout to something else than 0 in your session
(or in your transaction).
Then every statement longer than this many seconds will be
terminated.

Yours,
Laurenz Albe

В списке pgsql-general по дате отправления:

Предыдущее
От: durumdara
Дата:
Сообщение: Re: Transaction settings: nowait
Следующее
От: "Gauthier, Dave"
Дата:
Сообщение: XML -> PG ?