Re: Idle transactions

Поиск
Список
Период
Сортировка
От Tino Schwarze
Тема Re: Idle transactions
Дата
Msg-id 20070911113928.GB26986@easy2.in-chemnitz.de
обсуждение исходный текст
Ответ на Idle transactions  (Mateus Interciso <p.zarnick@gmail.com>)
Список pgsql-admin
On Tue, Sep 11, 2007 at 11:15:54AM +0000, Mateus Interciso wrote:

> Hello, it's been a while that I'm seeing that our servers running JBoss
> with PostgreSQL, after some hours of work, have at least 70 or more
> "<IDLE> in transaction" status for transactions, and this is bogging down
> our servers.
> Is this normal behaviour? If not, is there anything I can do to prevent
> it? Why is it happening? What's a transaction that is "<IDLE> in
> transaction" actually really means?

"idle in transaction" means that someone did a "begin", but didn't issue
a "commit" or "rollback" yet. It is often a sign of bad application
design and you should contact the application developers. Since open
transactions may hold locks on tables, the whole application may stop
unexpectedly if transactions are left open.

Another possibility is that you've just got a huge workload, e.g. lots
of concurrent access to the application so that it has to perform a lot
of work, but then you should see SELECT/INSERT/UPDATE/etc. as well, not
only "idle in transaction".

In Java terms, code which uses a transaction should always look like
this:
boolean success = false; // default: roll back, e.g. on Exception
connection.openTransaction();
try
{
  // perform work
  success = true;
}
finally
{
   connection.closeTransaction (success);
}

HTH,

Tino.

--
www.spiritualdesign-chemnitz.de
www.lebensraum11.de

Tino Schwarze * Parkstraße 17h * 09120 Chemnitz

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

Предыдущее
От: Thomas Markus
Дата:
Сообщение: Re: Idle transactions
Следующее
От: Mateus Interciso
Дата:
Сообщение: Re: Idle transactions