<p>What does it mean when a <a href="http://en.wikipedia.org/wiki/PostgreSQL" rel="noreferrer">PostgreSQL</a> process is "idle in transaction"?</p>

<p>On a server that I'm looking at, the output of "ps ax | grep postgres" I see 9 PostgreSQL processes that look like the following:</p>

<pre><code>postgres: user db 127.0.0.1(55658) idle in transaction
</code></pre>

<p>Does this mean that some of the processes are hung, waiting for a transaction to be committed?  Any pointers to relevant documentation are appreciated.</p>

[{'answer_id': 51058, 'author': 'Anonymoose', 'author_id': 2391, 'author_profile': 'https://Stackoverflow.com/users/2391', 'pm_score': 7, 'selected': True, 'text': '<p>The <a href="http://www.postgresql.org/docs/8.3/interactive/monitoring-ps.html" rel="noreferrer">PostgreSQL manual</a> indicates that this means the transaction is open (inside BEGIN) and idle.  It\'s most likely a user connected using the monitor who is thinking or typing.  I have plenty of those on my system, too.</p>\n\n<p>If you\'re using Slony for replication, however, the <a href="http://slony1.projects.postgresql.org/slony1-1.2.6/doc/adminguide/faq.html" rel="noreferrer">Slony-I FAQ</a> suggests <code>idle in transaction</code> may mean that the network connection was terminated abruptly.  Check out the discussion in that FAQ for more details.</p>\n'}, {'answer_id': 78159, 'author': 'Arthur Thomas', 'author_id': 14009, 'author_profile': 'https://Stackoverflow.com/users/14009', 'pm_score': 4, 'selected': False, 'text': '<p>As mentioned here: <a href="http://archives.postgresql.org/pgsql-bugs/2008-06/msg00102.php" rel="noreferrer">Re: BUG #4243: Idle in transaction</a> it is probably best to check your pg_locks table to see what is being locked and that might give you a better clue where the problem lies.</p>\n'}]
['https://Stackoverflow.com/questions/51019', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4883/']