Re: selecting a random record

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: selecting a random record
Дата
Msg-id
26586.981506519@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
selecting a random record Culley Harrelson <culleyharrelson@yahoo.com>
Re: selecting a random record Alexey Borzov <borz_off@rdw.ru>
Re: selecting a random record Warren Vanichuk <pyber@street-light.com>
Re: selecting a random record Tom Lane <tgl@sss.pgh.pa.us>
Re: Deadlock issues (was: Re: [GENERAL] selecting a random record) Warren Vanichuk <pyber@street-light.com>
Re: selecting a random record "Arun Malhotra - Roll No.99007" <arun@gdit.iiit.net>
Warren Vanichuk  writes:
> I have a smallish sized database that's getting alot of update transactions
> to it.  It's been running fine over the past several weeks, but suddenly I'm
> starting to see :

> NOTICE:  Deadlock detected -- See the lock(l) manual page for a possible cause.

You've probably added another function that updates the same rows in a
different, conflicting order.  For example, suppose you have two
transactions, one of which does

	UPDATE table SET f1 = 42 WHERE id = 'foo';

while the other is doing

	UPDATE table SET f1 = 23 WHERE id = 'bar';

This is fine, but now suppose the first one does

	UPDATE table SET f2 = 11 WHERE id = 'bar';

It's got to wait to see if the second one commits or not, to know which
version of the 'bar' row is relevant and should be updated.  Finally,
suppose the second transaction does

	UPDATE table SET f2 = 22 WHERE id = 'foo';

Now you have two transactions waiting for each other --- ie, deadlock.

			regards, tom lane
В списке pgsql-general по дате отправления
От: Tom Lane
Дата:
Сообщение: Re: pg_dump crash
От: Stephan Szabo
Дата:
Сообщение: Re: Select in function?
FAQ