<!--
    doc/src/sgml/ref/show_pool_pools.sgml
    Pgpool-II documentation
  -->

<refentry id="SQL-SHOW-POOL-POOLS">
 <indexterm zone="sql-show-pool-pools">
  <primary>SHOW POOL_POOLS</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>SHOW POOL_POOLS</refentrytitle>
  <manvolnum>1</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>SHOW POOL_POOLS</refname>
  <refpurpose>
   sends back a list of pools handled
   by <productname>Pgpool-II</productname>.
  </refpurpose>
 </refnamediv>

 <refsynopsisdiv>
  <synopsis>
   SHOW POOL_POOLS
  </synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>SHOW POOL_POOLS</command> sends back a list of pools
   handled by
   <productname>Pgpool-II</productname>
  </para>
  <para>
   It has 20 columns:
   <itemizedlist>
    <listitem>
     <para>
      <literal>pool_pid</literal> is the PID of the
      displayed <productname>Pgpool-II</productname> process.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>start_time</literal> is the timestamp of when
      this process was launched.
      <itemizedlist>
       <listitem>
        <para>
         If <xref linkend="guc-child-life-time"> is set not 0,
         the time before process restarting is displayed.
        </para>
       </listitem>
      </itemizedlist>
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>client_connection_count</literal> counts the number of times
      this process has been used by clients.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>pool_id</literal> is the pool identifier (should
      be between 0 and <xref linkend="guc-max-pool"> - 1)
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>backend_id</literal> is the backend identifier (should
      be between 0 and the number of configured backends minus one)
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>database</literal> is the database name for this
      process's pool id connection.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>username</literal> is the user name for this
      process's pool id connection.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>backend_connection_time</literal> is the creation time and
      date of the connection.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>client_connection_time</literal> is the date when a client
      last used this connection.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>client_disconnection_time</literal> is the date when a client
      last disconnected from this connection.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>client_idle_duration</literal> is the time (sec) that a client
      is in idle.
      <itemizedlist>
       <listitem>
        <para>
         If <xref linkend="guc-client-idle-limit"> is set not 0,
         the time before client disconnected is displayed.
        </para>
       </listitem>
      </itemizedlist>
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>majorversion</literal>
      and <literal>minorversion</literal> are the protocol
      version numbers used in this connection.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>pool_counter</literal> counts the number of times
      this pool of connections (process) has been used by
      clients.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>pool_backendpid</literal> is the PID of the
      PostgreSQL process.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>pool_connected</literal> is true (1) if a
      frontend is currently using this backend.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>status</literal> is current status of this process. Possible values are:
        <itemizedlist>
          <listitem>
            <para>
              <literal>Execute command</literal>: Executing a command.
            </para>
          </listitem>
          <listitem>
            <para>
              <literal>Idle</literal>: The process is waiting for a new client command.
            </para>
          </listitem>
          <listitem>
            <para>
              <literal>Idle in transaction</literal>: The process is waiting for a new client command
              in a transaction.
            </para>
          </listitem>
          <listitem>
            <para>
              <literal>Wait for connection</literal>: The process is waiting for a new client connection.
            </para>
          </listitem>
      </itemizedlist>
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>load_balance_node</literal> is true (1) if a
      frontend is currently using this backend and the backend is load balance node.
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>client_host</literal> is client's host name or IP address.
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>client_port</literal> is client's port number.
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>statement</literal> is the SQL statement last executed.
     </para>
    </listitem>

   </itemizedlist>
  </para>
  <para>
   It'll always return <xref linkend="guc-num-init-children"> * <xref linkend="guc-max-pool"> *
     number_of_backends lines.  Here is an example session:
     <programlisting>
test=# show pool_pools;
 pool_pid |                      start_time                      | client_connection_count | pool_id | backend_id | database | username | backend_connection_time | client_connection_time | client_disconnection_time | client_idle_duration | majorversion | minorversion | pool_counter | pool_backendpid | pool_connected |       status        | load_balance_node |  client_host  | client_port |  statement  
----------+------------------------------------------------------+-------------------------+---------+------------+----------+----------+-------------------------+------------------------+---------------------------+----------------------+--------------+--------------+--------------+-----------------+----------------+---------------------+-------------------+---------------+-------------+-------------
[snip]
 1336537  | 2025-06-24 10:53:35                                  | 0                       | 0       | 0          | test     | t-ishii  | 2025-06-24 10:55:58     | 2025-06-24 10:55:59    |                           | 0                    | 3            | 0            | 1            | 1336703         | 1              | Idle                | 0                 | 192.168.10.11 | 39216       | 
 1336537  | 2025-06-24 10:53:35                                  | 0                       | 0       | 1          | test     | t-ishii  | 2025-06-24 10:55:58     | 2025-06-24 10:55:59    |                           | 0                    | 3            | 0            | 1            | 1336704         | 1              | Idle                | 1                 | 192.168.10.11 | 39216       | select 1;
 1336537  | 2025-06-24 10:53:35                                  | 0                       | 1       | 0          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Idle                | 0                 | 192.168.10.11 | 39216       | 
 1336537  | 2025-06-24 10:53:35                                  | 0                       | 1       | 1          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Idle                | 0                 | 192.168.10.11 | 39216       | select 1;
 1336537  | 2025-06-24 10:53:35                                  | 0                       | 2       | 0          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Idle                | 0                 | 192.168.10.11 | 39216       | 
 1336537  | 2025-06-24 10:53:35                                  | 0                       | 2       | 1          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Idle                | 0                 | 192.168.10.11 | 39216       | select 1;
 1336537  | 2025-06-24 10:53:35                                  | 0                       | 3       | 0          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Idle                | 0                 | 192.168.10.11 | 39216       | 
 1336537  | 2025-06-24 10:53:35                                  | 0                       | 3       | 1          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Idle                | 0                 | 192.168.10.11 | 39216       | select 1;
[snip]
 1336544  | 2025-06-24 10:53:35 (0:23 before process restarting) | 1                       | 0       | 0          | test     | t-ishii  | 2025-06-24 10:53:42     | 2025-06-24 10:53:42    | 2025-06-24 10:55:37       | 0                    | 3            | 0            | 1            | 1336573         | 0              | Wait for connection | 0                 | 192.168.10.11 | 39162       | DISCARD ALL
 1336544  | 2025-06-24 10:53:35 (0:23 before process restarting) | 1                       | 0       | 1          | test     | t-ishii  | 2025-06-24 10:53:42     | 2025-06-24 10:53:42    | 2025-06-24 10:55:37       | 0                    | 3            | 0            | 1            | 1336574         | 0              | Wait for connection | 0                 | 192.168.10.11 | 39162       | 
 1336544  | 2025-06-24 10:53:35 (0:23 before process restarting) | 1                       | 1       | 0          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Wait for connection | 0                 | 192.168.10.11 | 39162       | DISCARD ALL
 1336544  | 2025-06-24 10:53:35 (0:23 before process restarting) | 1                       | 1       | 1          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Wait for connection | 0                 | 192.168.10.11 | 39162       | 
 1336544  | 2025-06-24 10:53:35 (0:23 before process restarting) | 1                       | 2       | 0          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Wait for connection | 0                 | 192.168.10.11 | 39162       | DISCARD ALL
 1336544  | 2025-06-24 10:53:35 (0:23 before process restarting) | 1                       | 2       | 1          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Wait for connection | 0                 | 192.168.10.11 | 39162       | 
 1336544  | 2025-06-24 10:53:35 (0:23 before process restarting) | 1                       | 3       | 0          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Wait for connection | 0                 | 192.168.10.11 | 39162       | DISCARD ALL
 1336544  | 2025-06-24 10:53:35 (0:23 before process restarting) | 1                       | 3       | 1          |          |          |                         |                        |                           | 0                    | 0            | 0            | 0            | 0               | 0              | Wait for connection | 0                 | 192.168.10.11 | 39162       | 
[snip]
(256 rows)
     </programlisting>

  </para>
 </refsect1>

</refentry>
