Re: PREPARE TRANSACTION and webapps

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: PREPARE TRANSACTION and webapps
Дата
Msg-id 20051111134422.GF13177@svana.org
обсуждение исходный текст
Ответ на Re: PREPARE TRANSACTION and webapps  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
On Fri, Nov 11, 2005 at 02:22:05PM +0100, Martijn van Oosterhout wrote:
> Every transaction takes locks, on every table it accesses. Shared lock,
> but locks anyway. UPDATEs take stronger locks, so any UPDATE may cause
> other queries to wait until you COMMIT or ABORT.

Note also, you don't want to use prepare transactions until you know
exactly what you're doing. Take for example (in a single session):

test=# begin;
BEGIN
test=# update test set value=1 where value=1;
UPDATE 1
test=# prepare transaction 'test';
PREPARE TRANSACTION
test=# begin;
BEGIN
test=# update test set value=1 where value=1;

and you've deadlocked yourself. Until you create another connection and
commit or rollback the prepared transaction, this query will never end.
This is at the lowest isolation level. You do not want to keep
transactions open longer than absolutly necessary.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: PREPARE TRANSACTION and webapps
Следующее
От: Víctor Narváez
Дата:
Сообщение: replicator