Re: Idle In Transaction

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Idle In Transaction
Дата
Msg-id 17728.1279057123@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Idle In Transaction  (Anthony Presley <anthony@resolution.com>)
Ответы Re: Idle In Transaction  (Anthony Presley <anthony@resolution.com>)
Список pgsql-general
Anthony Presley <anthony@resolution.com> writes:
> Every so often (usually in the early morning), we are seeing an "<IDLE>
> in transaction" show up.  This appears to lock / block other statements
> from going through, though I'm not sure why.  If left unchecked, we end
> up with all of our connections being overrun.

Well, the idle transaction is evidently sitting on some lock that the
UPDATE needs.  You didn't show the pg_locks columns that would tell
exactly what lock it is though ...

> Would a connection pooler cause (or amplify) any issues relating to
> this?

It shouldn't.  Any decent pooler will ensure that no transaction remains
open when it transfers the connection to another client.

> How can I track down the issue here?  I've been looking through
> web app and database logs without much luck.

Can you track the session connection (the port number) back to a client
process?  If there's a pooler in the way you'll probably need to crank
up its logging level to be able to make that association.  Once you've
got that, you could attach to the client with a debugger and see what it
thinks it's doing.

The other line of attack I can think of is to turn on log_connections
and log_statements and make sure log_line_prefix includes the PID.
Then you can find the series of statements that were issued before
the idle transaction went to sleep, and that hopefully is enough
information to track down the client code.

            regards, tom lane

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

Предыдущее
От: "Duncavage, Daniel P. (JSC-OD211)"
Дата:
Сообщение: Re: NASA needs Postgres - Nagios help
Следующее
От: Joshua Rubin
Дата:
Сообщение: Efficient Way to Merge Two Large Tables