<docbook><section><title>MonitorPostreSQLSessions</title><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> How Do I Monitor Open Database Sessions Associated With PostgreSQL ODBC Connections</bridgehead>
<para>Users can run <emphasis>ps auxww | grep ^postgres</emphasis> to display current connections.
 Connection information will appear after entries for the postmaster and statistics collector.
 For example:</para>
<programlisting>$ ps auxww | grep ^postgres
postgres   850  0.0  1.1  4204 980   pts/1  SN   20:05   postmaster -i
postgres   853  0.0  1.1  5076 2327 pts/1  SN   20:05   postgres: stats buffer process   
postgres   855  0.0  1.1  4125 1618 pts/1  SN   20:05   postgres: stats collector process   
postgres   888  0.0  2.3  4523 4008 pts/1  SN   20:10   postgres: openlink test 192.168.13.146 idle
postgres   943  0.0  2.4  4523 5132 pts/1  SN   20:11   postgres: openlink regression 192.168.13.146 SELECT waiting
</programlisting><para> Note the following entries:</para>
<programlisting>postgres   888  0.0  2.3  4523 4008 pts/1  SN   20:10   postgres: openlink test 192.168.13.146 idle
postgres   943  0.0  2.4  4523 5132 pts/1  SN   20:11   postgres: openlink regression 192.168.13.146 SELECT waiting
</programlisting><para> Each entry represents database activity.
 Here is the syntax the output employs:</para>
<para>postgres: <emphasis>user database host activity</emphasis></para>
<para>For example:</para>
<programlisting>postgres: openlink test 192.168.13.146 idle
postgres: openlink regression 192.168.13.146 SELECT waiting
</programlisting><para> Return values for the activity column may include a specific SQL command such as SELECT, idle, idle in transaction, or waiting.
 Connections go into idel status when the database is awaiting the issuance of a SQL command.
 The idle in transaction notation occurs when the database is waiting for a client in a BEGIN block.
 Waiting entails that the server is waiting for a lock to be released.</para>
 <para><emphasis>Note</emphasis>: Solaris users must run the following command to insure proper output: <emphasis>/usr/ucb/ps auxww | grep ^postgres</emphasis> </para>
</section></docbook>