Re: ERROR: deadlock detected

Поиск
Список
Период
Сортировка
От Torsten Förtsch
Тема Re: ERROR: deadlock detected
Дата
Msg-id CAKkG4_=gty0EE1Xts88yKduKJyR=fa_5VGOkD=jEQu6RFmHg_Q@mail.gmail.com
обсуждение исходный текст
Ответ на ERROR: deadlock detected  (Matthias Apitz <guru@unixarea.de>)
Список pgsql-general
On Tue, Feb 7, 2023 at 12:47 PM Matthias Apitz <guru@unixarea.de> wrote:


We saw the following message in the file postgres-serverlog.error:

2023-01-24 17:16:16.578 CET [17468] ERROR:  deadlock detected
2023-01-24 17:16:16.578 CET [17468] DETAIL:  Process 17468 waits for ShareLock on transaction 90776649; blocked by process 17724.
        Process 17724 waits for ShareLock on transaction 90776650; blocked by process 17468.
        Process 17468: fetch hc_d03geb
        Process 17724: fetch hc_d02ben
2023-01-24 17:16:16.578 CET [17468] HINT:  See server log for query details.
2023-01-24 17:16:16.578 CET [17468] CONTEXT:  while locking tuple (948,45) in relation "d03geb"
2023-01-24 17:16:16.578 CET [17468] STATEMENT:  fetch hc_d03geb

The process numbers are internal ones of the PostgreSQL server and not
the Linux PID, correct?

If you run this on linux, then the process numbers are the PIDs of the postgres backend processes. They are not the PIDs of your application but what would be returned by `pg_backend_pid()` or what you see in `pg_stat_activity`.

This piece (948,45) is the CTID of the tuple where the deadlock occurred.

If you really want to find out how the deadlock came about, you could use pg_waldump. You search for the transaction ids and figure out what they were doing.

Torsten

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

Предыдущее
От: Matthias Apitz
Дата:
Сообщение: ERROR: deadlock detected
Следующее
От: Giovanni Biscontini
Дата:
Сообщение: Re: PostgreSQL