<!ENTITY pgpoolAdmPcpNodeCount SYSTEM "pgpool_adm_pcp_node_count.sgml">
<!ENTITY pgpoolAdmPcpAttachNode SYSTEM "pgpool_adm_pcp_attach_node.sgml">
<!ENTITY pgpoolAdmPcpDetachNode SYSTEM "pgpool_adm_pcp_detach_node.sgml">
+<!ENTITY pgpoolAdmPcpProcInfo SYSTEM "pgpool_adm_pcp_proc_info.sgml">
-->
例を示します。
<programlisting>
-$ pcp_proc_info -p 1100
-test postgres 2021-09-28 04:16:00 (4:56 before process restarting) 1 3 0 2021-09-28 04:16:16 2021-09-28 04:16:16 0 2021-09-28 04:16:33 1 30795 0 30750 0 Wait for connection
-test postgres 2021-09-28 04:16:00 (4:56 before process restarting) 1 3 0 2021-09-28 04:16:16 2021-09-28 04:16:16 0 2021-09-28 04:16:33 1 30796 0 30750 1 Wait for connection
-test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 34 (4:26 before client disconnected) 1 30763 1 30751 0 Idle
-test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 34 (4:26 before client disconnected) 1 30764 1 30751 1 Idle
-$ pcp_proc_info -p 11001 30751
-test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 58 (4:02 before client disconnected) 1 30763 1 30751 0 Idle
-test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 58 (4:02 before client disconnected) 1 30764 1 30751 1 Idle
+$ pcp_proc_info -p 11001
+test t-ishii 2025-06-24 10:53:35 0 3 0 2025-06-24 10:55:58 2025-06-24 10:55:59 0 1 1336703 1 1336537 0 Idle 0 192.168.10.11 39216
+test t-ishii 2025-06-24 10:53:35 0 3 0 2025-06-24 10:55:58 2025-06-24 10:55:59 0 1 1336704 1 1336537 1 Idle 1 192.168.10.11 39216
+test t-ishii 2025-06-24 10:53:35 (4:03 before process restarting) 1 3 0 2025-06-24 10:53:42 2025-06-24 10:53:42 0 2025-06-24 10:55:37 1 1336573 0 1336544 0 Wait for connection 0 192.168.10.11 39162
+test t-ishii 2025-06-24 10:53:35 (4:03 before process restarting) 1 3 0 2025-06-24 10:53:42 2025-06-24 10:53:42 0 2025-06-24 10:55:37 1 1336574 0 1336544 1 Wait for connection 0 192.168.10.11 39162
</programlisting>
</para>
<para>
15. PostgreSQL backend id
16. process status
17. 1 if backend is load balance node and frontend connected, 0 otherwise
+ 18. client's host name
+ 19. client's port number (not shown if Unix domain socket or localhost)
+ 20. SQL statement last executed
-->
1. 接続先のデータベース名
2. 接続先のユーザ名
15. PostgreSQLバックエンドID
16. プロセスの状態
17. フロントエンドが接続中でバックエンドが負荷分散ノードならば1, そうでなければ0
+ 18. クライアントのホスト名
+ 19. クライアントのポート番号 (Unixドメインソケット、localhostでは表示されません)
+ 20. 最後に実行したSQL文
</literallayout>
</para>
<para>
<programlisting>
$ pcp_proc_info -p 11001 --verbose
Database : test
-Username : postgres
-Start time : 2021-09-28 04:16:00 (2:52 before process restarting)
-Client connection count : 1
+Username : t-ishii
+Start time : 2025-06-24 10:53:35
+Client connection count : 0
Major : 3
Minor : 0
-Backend connection time : 2021-09-28 04:16:16
-Client connection time : 2021-09-28 04:16:16
+Backend connection time : 2025-06-24 10:55:58
+Client connection time : 2025-06-24 10:55:59
Client idle duration : 0
-Client disconnection time : 2021-09-28 04:16:33
+Client disconnection time :
Pool Counter : 1
-Backend PID : 30795
-Connected : 0
-PID : 30750
+Backend PID : 1336703
+Connected : 1
+PID : 1336537
Backend ID : 0
-Status : Wait for connection
+Status : Idle
Load balance node : 0
+client_host : 192.168.10.11
+client_port : 39216
+statement :
Database : test
-Username : postgres
-Start time : 2021-09-28 04:16:00 (2:52 before process restarting)
-Client connection count : 1
+Username : t-ishii
+Start time : 2025-06-24 10:53:35
+Client connection count : 0
Major : 3
Minor : 0
-Backend connection time : 2021-09-28 04:16:16
-Client connection time : 2021-09-28 04:16:16
+Backend connection time : 2025-06-24 10:55:58
+Client connection time : 2025-06-24 10:55:59
Client idle duration : 0
-Client disconnection time : 2021-09-28 04:16:33
+Client disconnection time :
Pool Counter : 1
-Backend PID : 30796
-Connected : 0
-PID : 30750
+Backend PID : 1336704
+Connected : 1
+PID : 1336537
Backend ID : 1
-Status : Wait for connection
-Load balance node : 0
+Status : Idle
+Load balance node : 1
+client_host : 192.168.10.11
+client_port : 39216
+statement : select 1;
Database : test
-Username : kawamoto
-Start time : 2021-09-28 04:16:00
-Client connection count : 0
+Username : t-ishii
+Start time : 2025-06-24 10:53:35 (4:33 before process restarting)
+Client connection count : 1
Major : 3
Minor : 0
-Backend connection time : 2021-09-28 04:16:03
-Client connection time : 2021-09-28 04:16:03
-Client idle duration : 158 (2:22 before client disconnected)
-Client disconnection time :
+Backend connection time : 2025-06-24 10:53:42
+Client connection time : 2025-06-24 10:53:42
+Client idle duration : 0
+Client disconnection time : 2025-06-24 10:55:37
Pool Counter : 1
-Backend PID : 30763
-Connected : 1
-PID : 30751
+Backend PID : 1336573
+Connected : 0
+PID : 1336544
Backend ID : 0
-Status : Idle
-Load balance node : 1
+Status : Wait for connection
+Load balance node : 0
+client_host : 192.168.10.11
+client_port : 39162
+statement : DISCARD ALL
Database : test
-Username : kawamoto
-Start time : 2021-09-28 04:16:00
-Client connection count : 0
+Username : t-ishii
+Start time : 2025-06-24 10:53:35 (4:33 before process restarting)
+Client connection count : 1
Major : 3
Minor : 0
-Backend connection time : 2021-09-28 04:16:03
-Client connection time : 2021-09-28 04:16:03
-Client idle duration : 158 (2:22 before client disconnected)
-Client disconnection time :
+Backend connection time : 2025-06-24 10:53:42
+Client connection time : 2025-06-24 10:53:42
+Client idle duration : 0
+Client disconnection time : 2025-06-24 10:55:37
Pool Counter : 1
-Backend PID : 30764
-Connected : 1
-PID : 30751
+Backend PID : 1336574
+Connected : 0
+PID : 1336544
Backend ID : 1
-Status : Idle
-Load balance node : 1
+Status : Wait for connection
+Load balance node : 0
+client_host : 192.168.10.11
+client_port : 39162
+statement :
</programlisting>
</refsect1>
--- /dev/null
+<!--
+doc/src/sgml/ref/pgpool_adm_pcp_proc_info.sgml
+Pgpool-II documentation
+-->
+
+<refentry id="PGPOOL-ADM-PCP-PROC-INFO">
+ <indexterm zone="pgpool-adm-pcp-proc-info">
+ <primary>pgpool_adm_pcp_proc_info</primary>
+ </indexterm>
+
+ <refmeta>
+ <refentrytitle>pgpool_adm_pcp_proc_info</refentrytitle>
+ <manvolnum>3</manvolnum>
+ <refmiscinfo>pgpool_adm extension</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+ <refname>pgpool_adm_pcp_proc_info</refname>
+ <refpurpose>
+ <productname>Pgpool-II</productname>の子プロセスの情報を表示する関数
+ </refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef><function>pcp_proc_info</function> returns record</funcdef>
+ <paramdef>text <parameter>host</parameter></paramdef>
+ <paramdef>integer <parameter>port</parameter></paramdef>
+ <paramdef>text <parameter>username</parameter></paramdef>
+ <paramdef>text <parameter>password</parameter></paramdef>
+ <paramdef>out <parameter>database text</parameter></paramdef>
+ <paramdef>out <parameter>username text</parameter></paramdef>
+ <paramdef>out <parameter>start_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_connection_count text</parameter></paramdef>
+ <paramdef>out <parameter>major text</parameter></paramdef>
+ <paramdef>out <parameter>minor text</parameter></paramdef>
+ <paramdef>out <parameter>backend_connection_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_connection_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_idle_duration text</parameter></paramdef>
+ <paramdef>out <parameter>client_disconnection_time text</parameter></paramdef>
+ <paramdef>out <parameter>pool_counter text</parameter></paramdef>
+ <paramdef>out <parameter>backend_pid text</parameter></paramdef>
+ <paramdef>out <parameter>connected text</parameter></paramdef>
+ <paramdef>out <parameter>pid text</parameter></paramdef>
+ <paramdef>out <parameter>backend_id text</parameter></paramdef>
+ <paramdef>out <parameter>status text</parameter></paramdef>
+ <paramdef>out <parameter>load_balance_node text</parameter></paramdef>
+ <paramdef>out <parameter>client_host text</parameter></paramdef>
+ <paramdef>out <parameter>client_port text</parameter></paramdef>
+ <paramdef>out <parameter>statement </parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef><function>pcp_proc_info</function> returns record</funcdef>
+ <paramdef>integer <parameter>node_id</parameter></paramdef>
+ <paramdef>text <parameter>pcp_server</parameter></paramdef>
+ <paramdef>out <parameter>database text</parameter></paramdef>
+ <paramdef>out <parameter>username text</parameter></paramdef>
+ <paramdef>out <parameter>start_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_connection_count text</parameter></paramdef>
+ <paramdef>out <parameter>major text</parameter></paramdef>
+ <paramdef>out <parameter>minor text</parameter></paramdef>
+ <paramdef>out <parameter>backend_connection_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_connection_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_idle_duration text</parameter></paramdef>
+ <paramdef>out <parameter>client_disconnection_time text</parameter></paramdef>
+ <paramdef>out <parameter>pool_counter text</parameter></paramdef>
+ <paramdef>out <parameter>backend_pid text</parameter></paramdef>
+ <paramdef>out <parameter>connected text</parameter></paramdef>
+ <paramdef>out <parameter>pid text</parameter></paramdef>
+ <paramdef>out <parameter>backend_id text</parameter></paramdef>
+ <paramdef>out <parameter>status text</parameter></paramdef>
+ <paramdef>out <parameter>load_balance_node text</parameter></paramdef>
+ <paramdef>out <parameter>client_host text</parameter></paramdef>
+ <paramdef>out <parameter>client_port text</parameter></paramdef>
+ <paramdef>out <parameter>statement </parameter></paramdef>
+ </funcprototype>
+
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1 id="R3-PCP-PROC-INFO-3">
+ <title>説明</title>
+ <para>
+ <function>pcp_proc_info</function>
+ <productname>Pgpool-II</productname>の子プロセスの情報を表示します。
+ 表示される情報は<xref linkend="pcp-proc-info">と同じです。
+ すべてのデータ型は"text"です。
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>引数</title>
+ <para>
+ <variablelist>
+
+ <varlistentry>
+ <term><replaceable class="parameter">pcp_server</replaceable></term>
+ <listitem>
+ <para>
+ pcpサーバの外部サーバ名
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>他の引数</option></term>
+ <listitem>
+ <para>
+ <xref linkend="pcp-common-options">を参照ください。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>使用例</title>
+ <para>
+ 以下の例では、検索条件で"connected"列 = '1'を指定して、現在クライアントから接続のあるプロセス情報のみを表示しています。
+ このpsqlセッションでfrom pcp_proc_infoを呼び出していて、その情報は行1と2に表示されています。
+ select文はbackend_id = '0'(おそらくprimaryです)にのみ送信されているので、行1の"status"列は"Execute command"となっており、"statement"列には実行したselect文が表示されていますが、backend_id = '1'にはselect文が送信されていないので、行2のstatementは空白となっています。
+ </para>
+ <para>
+ 別psqlセッションの情報は行2, 3に表示されています。
+ この例では"select 1"は"backend_id" = '1'(おそらくstandby)に送信されています。
+ <programlisting>
+test=# select * from pcp_proc_info(host => '', port => 11001, username => 't-ishii', password => 't-ishii') where connected = '1';
+-[ RECORD 1 ]-------------+----------------------------------------------------------------------------------------------------------------------------
+database | test
+username | t-ishii
+start_time | 2025-02-22 20:56:08
+client_connection_count | 0
+major | 3
+minor | 0
+backend_connection_time | 2025-02-22 20:58:37
+client_connection_time | 2025-02-22 20:58:37
+client_idle_duration | 0
+client_disconnection_time |
+pool_counter | 1
+backend_pid | 14750
+connected | 1
+pid | 14585
+backend_id | 0
+status | Execute command
+load_balance_node | 1
+client_host | 127.0.0.1
+client_port | 59120
+statement | select * from pcp_proc_info(host => '', port => 11001, username => 't-ishii', password => 't-ishii') where connected = '1';
+-[ RECORD 2 ]-------------+----------------------------------------------------------------------------------------------------------------------------
+database | test
+username | t-ishii
+start_time | 2025-02-22 20:56:08
+client_connection_count | 0
+major | 3
+minor | 0
+backend_connection_time | 2025-02-22 20:58:37
+client_connection_time | 2025-02-22 20:58:37
+client_idle_duration | 0
+client_disconnection_time |
+pool_counter | 1
+backend_pid | 14751
+connected | 1
+pid | 14585
+backend_id | 1
+status | Execute command
+load_balance_node | 0
+client_host | 127.0.0.1
+client_port | 59120
+statement |
+-[ RECORD 3 ]-------------+----------------------------------------------------------------------------------------------------------------------------
+database | test
+username | t-ishii
+start_time | 2025-02-22 20:56:08
+client_connection_count | 0
+major | 3
+minor | 0
+backend_connection_time | 2025-02-22 20:58:56
+client_connection_time | 2025-02-22 20:58:56
+client_idle_duration | 0
+client_disconnection_time |
+pool_counter | 1
+backend_pid | 14767
+connected | 1
+pid | 14601
+backend_id | 0
+status | Idle
+load_balance_node | 0
+client_host | 127.0.0.1
+client_port | 54072
+statement |
+-[ RECORD 4 ]-------------+----------------------------------------------------------------------------------------------------------------------------
+database | test
+username | t-ishii
+start_time | 2025-02-22 20:56:08
+client_connection_count | 0
+major | 3
+minor | 0
+backend_connection_time | 2025-02-22 20:58:56
+client_connection_time | 2025-02-22 20:58:56
+client_idle_duration | 0
+client_disconnection_time |
+pool_counter | 1
+backend_pid | 14768
+connected | 1
+pid | 14601
+backend_id | 1
+status | Idle
+load_balance_node | 1
+client_host | 127.0.0.1
+client_port | 54072
+statement | select 1;
+ </programlisting>
+ </para>
+ <para>
+ 次の例では、"pgpool_query_info"という関数を登録し、pgpool_adm_pcp_proc_info、pgpool_adm_pcp_node_info、pgpool_adm_pcp_pool_statusを結合してpgpoolの子プロセスが最後に実行したクエリを、次の情報と一緒に表示します。
+ usernae, database, client host, client port, pgpool host, pgpool
+ port, pgpool pid, backend host, backend port, backend pid, backend
+ role and SQL statement。
+ <programlisting>
+create function pgpool_query_info(pcp_host text, pcp_port int, pgpool_username text, password text)
+returns table (username text, database text, client_host text, client_port text,
+pgpool_host text, pgpool_port text, pgpool_pid text,
+backend_host text, backend_port text, backend_pid text, backend_role text, statement text) as $$
+select p.username, p.database, p.client_host,p.client_port,
+$1 as pgpool_host, s.value as pgpool_port, p.pid as pgpool_pid,
+b.host as backend_host, b.port as backend_port, p.backend_pid as backend_pid,
+b.role as backend_role,
+p.statement
+from pcp_proc_info(host=> $1, port => $2, username => $3, password => $4) as p,
+pcp_node_info(node_id=>p.backend_id::int, host => $1, port => $2,
+username => $3, password => $4) as b,
+pcp_pool_status(host=> $1, port => $2, username => $3, password => $4) as s
+where p.connected = 1::text and p.statement != '' and
+p.statement !~ 'pcp_proc_info' and p.statement !~ 'pgpool_query_info' and
+s.item = 'port'
+$$
+language SQL;
+CREATE FUNCTION
+
+select * from pgpool_query_info('192.168.10.11', 11001, 't-ishii', 't-ishii');
+ username | database | client_host | client_port | pgpool_host | pgpool_port | pgpool_pid | backend_host | backend_port | backend_pid | backend_role | statement
+----------+----------+---------------+-------------+---------------+-------------+------------+--------------+--------------+-------------+--------------+-----------
+ t-ishii | test | 192.168.10.11 | 60542 | 192.168.10.11 | 11000 | 1356156 | localhost | 11002 | 1356240 | Primary | select 2;
+ t-ishii | test | 192.168.10.11 | 43856 | 192.168.10.11 | 11000 | 1356167 | localhost | 11003 | 1356255 | Standby | select 1;
+(2 rows)
+ </programlisting>
+ </para>
+ <para>
+ 表示データの詳細に関しては<xref linkend="pcp-proc-info">をご覧ください。
+ </para>
+
+ </refsect1>
+
+</refentry>
</para>
<para>
<!--
- It has 17 columns:
+ It has 20 columns:
-->
- 17のカラムがあります。
+ 20のカラムがあります。
<itemizedlist>
<listitem>
<para>
</para>
</listitem>
+ <listitem>
+ <para>
+ <!--
+ <literal>client_host</literal> is client's host name or IP address.
+ -->
+ <literal>client_host</literal>はクライアントのホスト名またはIPアドレスです。
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <!--
+ <literal>client_port</literal> is client's port number.
+ -->
+ <literal>client_port</literal>はクライアントのポート番号です(Unixドメインソケット、localhostでは表示されません)。
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <!--
+ <literal>statement</literal> is the SQL statement last executed.
+ -->
+ <literal>statement</literal>は最後に実行したSQL文です。
+ </para>
+ </listitem>
+
</itemizedlist>
</para>
<para>
ここでは例を示します。
<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
-----------+---------------------+-------------------------+---------+------------+----------+----------+-------------------------+------------------------+---------------------------+----------------------+--------------+--------------+--------------+-----------------+----------------+---------------------+-------------------
- 641408 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 0 | 0 | test | t-ishii | 2023-07-10 13:20:56 | 2023-07-10 13:20:56 | | 0 | 3 | 0 | 1 | 641448 | 1 | Idle | 1
- 641412 | 2023-07-10 13:20:51 | 0 | 0 | 1 | test | t-ishii | 2023-07-10 13:20:56 | 2023-07-10 13:20:56 | | 0 | 3 | 0 | 1 | 641449 | 1 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 0 | 0 | test | t-ishii | 2023-07-10 13:21:04 | 2023-07-10 13:21:04 | | 0 | 3 | 0 | 1 | 641455 | 1 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 0 | 1 | test | t-ishii | 2023-07-10 13:21:04 | 2023-07-10 13:21:04 | | 0 | 3 | 0 | 1 | 641456 | 1 | Execute command | 1
- 641415 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
-(128 rows)
+ 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>
&pgpoolAdmPcpNodeCount
&pgpoolAdmPcpAttachNode
&pgpoolAdmPcpDetachNode
+ &pgpoolAdmPcpProcInfo
</reference>
<!ENTITY pgpoolAdmPcpNodeCount SYSTEM "pgpool_adm_pcp_node_count.sgml">
<!ENTITY pgpoolAdmPcpAttachNode SYSTEM "pgpool_adm_pcp_attach_node.sgml">
<!ENTITY pgpoolAdmPcpDetachNode SYSTEM "pgpool_adm_pcp_detach_node.sgml">
+<!ENTITY pgpoolAdmPcpProcInfo SYSTEM "pgpool_adm_pcp_proc_info.sgml">
<para>
Here is an example output:
<programlisting>
-$ pcp_proc_info -p 1100
-test postgres 2021-09-28 04:16:00 (4:56 before process restarting) 1 3 0 2021-09-28 04:16:16 2021-09-28 04:16:16 0 2021-09-28 04:16:33 1 30795 0 30750 0 Wait for connection
-test postgres 2021-09-28 04:16:00 (4:56 before process restarting) 1 3 0 2021-09-28 04:16:16 2021-09-28 04:16:16 0 2021-09-28 04:16:33 1 30796 0 30750 1 Wait for connection
-test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 34 (4:26 before client disconnected) 1 30763 1 30751 0 Idle
-test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 34 (4:26 before client disconnected) 1 30764 1 30751 1 Idle
-$ pcp_proc_info -p 11001 30751
-test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 58 (4:02 before client disconnected) 1 30763 1 30751 0 Idle
-test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 58 (4:02 before client disconnected) 1 30764 1 30751 1 Idle
+$ pcp_proc_info -p 11001
+test t-ishii 2025-06-24 10:53:35 0 3 0 2025-06-24 10:55:58 2025-06-24 10:55:59 0 1 1336703 1 1336537 0 Idle 0 192.168.10.11 39216
+test t-ishii 2025-06-24 10:53:35 0 3 0 2025-06-24 10:55:58 2025-06-24 10:55:59 0 1 1336704 1 1336537 1 Idle 1 192.168.10.11 39216
+test t-ishii 2025-06-24 10:53:35 (4:03 before process restarting) 1 3 0 2025-06-24 10:53:42 2025-06-24 10:53:42 0 2025-06-24 10:55:37 1 1336573 0 1336544 0 Wait for connection 0 192.168.10.11 39162
+test t-ishii 2025-06-24 10:53:35 (4:03 before process restarting) 1 3 0 2025-06-24 10:53:42 2025-06-24 10:53:42 0 2025-06-24 10:55:37 1 1336574 0 1336544 1 Wait for connection 0 192.168.10.11 39162
</programlisting>
</para>
<para>
15. PostgreSQL backend id
16. process status
17. 1 if backend is load balance node and frontend connected, 0 otherwise
+ 18. client's host name
+ 19. client's port number (not shown if Unix domain socket or localhost)
+ 20. SQL statement last executed
</literallayout>
</para>
<para>
<programlisting>
$ pcp_proc_info -p 11001 --verbose
Database : test
-Username : postgres
-Start time : 2021-09-28 04:16:00 (2:52 before process restarting)
-Client connection count : 1
+Username : t-ishii
+Start time : 2025-06-24 10:53:35
+Client connection count : 0
Major : 3
Minor : 0
-Backend connection time : 2021-09-28 04:16:16
-Client connection time : 2021-09-28 04:16:16
+Backend connection time : 2025-06-24 10:55:58
+Client connection time : 2025-06-24 10:55:59
Client idle duration : 0
-Client disconnection time : 2021-09-28 04:16:33
+Client disconnection time :
Pool Counter : 1
-Backend PID : 30795
-Connected : 0
-PID : 30750
+Backend PID : 1336703
+Connected : 1
+PID : 1336537
Backend ID : 0
-Status : Wait for connection
+Status : Idle
Load balance node : 0
+client_host : 192.168.10.11
+client_port : 39216
+statement :
Database : test
-Username : postgres
-Start time : 2021-09-28 04:16:00 (2:52 before process restarting)
-Client connection count : 1
+Username : t-ishii
+Start time : 2025-06-24 10:53:35
+Client connection count : 0
Major : 3
Minor : 0
-Backend connection time : 2021-09-28 04:16:16
-Client connection time : 2021-09-28 04:16:16
+Backend connection time : 2025-06-24 10:55:58
+Client connection time : 2025-06-24 10:55:59
Client idle duration : 0
-Client disconnection time : 2021-09-28 04:16:33
+Client disconnection time :
Pool Counter : 1
-Backend PID : 30796
-Connected : 0
-PID : 30750
+Backend PID : 1336704
+Connected : 1
+PID : 1336537
Backend ID : 1
-Status : Wait for connection
-Load balance node : 0
+Status : Idle
+Load balance node : 1
+client_host : 192.168.10.11
+client_port : 39216
+statement : select 1;
Database : test
-Username : kawamoto
-Start time : 2021-09-28 04:16:00
-Client connection count : 0
+Username : t-ishii
+Start time : 2025-06-24 10:53:35 (4:33 before process restarting)
+Client connection count : 1
Major : 3
Minor : 0
-Backend connection time : 2021-09-28 04:16:03
-Client connection time : 2021-09-28 04:16:03
-Client idle duration : 158 (2:22 before client disconnected)
-Client disconnection time :
+Backend connection time : 2025-06-24 10:53:42
+Client connection time : 2025-06-24 10:53:42
+Client idle duration : 0
+Client disconnection time : 2025-06-24 10:55:37
Pool Counter : 1
-Backend PID : 30763
-Connected : 1
-PID : 30751
+Backend PID : 1336573
+Connected : 0
+PID : 1336544
Backend ID : 0
-Status : Idle
-Load balance node : 1
+Status : Wait for connection
+Load balance node : 0
+client_host : 192.168.10.11
+client_port : 39162
+statement : DISCARD ALL
Database : test
-Username : kawamoto
-Start time : 2021-09-28 04:16:00
-Client connection count : 0
+Username : t-ishii
+Start time : 2025-06-24 10:53:35 (4:33 before process restarting)
+Client connection count : 1
Major : 3
Minor : 0
-Backend connection time : 2021-09-28 04:16:03
-Client connection time : 2021-09-28 04:16:03
-Client idle duration : 158 (2:22 before client disconnected)
-Client disconnection time :
+Backend connection time : 2025-06-24 10:53:42
+Client connection time : 2025-06-24 10:53:42
+Client idle duration : 0
+Client disconnection time : 2025-06-24 10:55:37
Pool Counter : 1
-Backend PID : 30764
-Connected : 1
-PID : 30751
+Backend PID : 1336574
+Connected : 0
+PID : 1336544
Backend ID : 1
-Status : Idle
-Load balance node : 1
+Status : Wait for connection
+Load balance node : 0
+client_host : 192.168.10.11
+client_port : 39162
+statement :
</programlisting>
</refsect1>
--- /dev/null
+<!--
+doc/src/sgml/ref/pgpool_adm_pcp_proc_info.sgml
+Pgpool-II documentation
+-->
+
+<refentry id="PGPOOL-ADM-PCP-PROC-INFO">
+ <indexterm zone="pgpool-adm-pcp-proc-info">
+ <primary>pgpool_adm_pcp_proc_info</primary>
+ </indexterm>
+
+ <refmeta>
+ <refentrytitle>pgpool_adm_pcp_proc_info</refentrytitle>
+ <manvolnum>3</manvolnum>
+ <refmiscinfo>pgpool_adm extension</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+ <refname>pgpool_adm_pcp_proc_info</refname>
+ <refpurpose>
+ a function to display the information
+ on <productname>Pgpool-II</productname> child process
+ </refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef><function>pcp_proc_info</function> returns record</funcdef>
+ <paramdef>text <parameter>host</parameter></paramdef>
+ <paramdef>integer <parameter>port</parameter></paramdef>
+ <paramdef>text <parameter>username</parameter></paramdef>
+ <paramdef>text <parameter>password</parameter></paramdef>
+ <paramdef>out <parameter>database text</parameter></paramdef>
+ <paramdef>out <parameter>username text</parameter></paramdef>
+ <paramdef>out <parameter>start_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_connection_count text</parameter></paramdef>
+ <paramdef>out <parameter>major text</parameter></paramdef>
+ <paramdef>out <parameter>minor text</parameter></paramdef>
+ <paramdef>out <parameter>backend_connection_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_connection_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_idle_duration text</parameter></paramdef>
+ <paramdef>out <parameter>client_disconnection_time text</parameter></paramdef>
+ <paramdef>out <parameter>pool_counter text</parameter></paramdef>
+ <paramdef>out <parameter>backend_pid text</parameter></paramdef>
+ <paramdef>out <parameter>connected text</parameter></paramdef>
+ <paramdef>out <parameter>pid text</parameter></paramdef>
+ <paramdef>out <parameter>backend_id text</parameter></paramdef>
+ <paramdef>out <parameter>status text</parameter></paramdef>
+ <paramdef>out <parameter>load_balance_node text</parameter></paramdef>
+ <paramdef>out <parameter>client_host text</parameter></paramdef>
+ <paramdef>out <parameter>client_port text</parameter></paramdef>
+ <paramdef>out <parameter>statement </parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef><function>pcp_proc_info</function> returns record</funcdef>
+ <paramdef>integer <parameter>node_id</parameter></paramdef>
+ <paramdef>text <parameter>pcp_server</parameter></paramdef>
+ <paramdef>out <parameter>database text</parameter></paramdef>
+ <paramdef>out <parameter>username text</parameter></paramdef>
+ <paramdef>out <parameter>start_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_connection_count text</parameter></paramdef>
+ <paramdef>out <parameter>major text</parameter></paramdef>
+ <paramdef>out <parameter>minor text</parameter></paramdef>
+ <paramdef>out <parameter>backend_connection_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_connection_time text</parameter></paramdef>
+ <paramdef>out <parameter>client_idle_duration text</parameter></paramdef>
+ <paramdef>out <parameter>client_disconnection_time text</parameter></paramdef>
+ <paramdef>out <parameter>pool_counter text</parameter></paramdef>
+ <paramdef>out <parameter>backend_pid text</parameter></paramdef>
+ <paramdef>out <parameter>connected text</parameter></paramdef>
+ <paramdef>out <parameter>pid text</parameter></paramdef>
+ <paramdef>out <parameter>backend_id text</parameter></paramdef>
+ <paramdef>out <parameter>status text</parameter></paramdef>
+ <paramdef>out <parameter>load_balance_node text</parameter></paramdef>
+ <paramdef>out <parameter>client_host text</parameter></paramdef>
+ <paramdef>out <parameter>client_port text</parameter></paramdef>
+ <paramdef>out <parameter>statement </parameter></paramdef>
+ </funcprototype>
+
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1 id="R3-PCP-PROC-INFO-3">
+ <title>Description</title>
+ <para>
+ <function>pcp_proc_info</function>
+ displays the information
+ on <productname>Pgpool-II</productname> child process.
+ All the information is same as <xref linkend="pcp-proc-info">.
+ All the data types are "text".
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Arguments</title>
+ <para>
+ <variablelist>
+
+ <varlistentry>
+ <term><replaceable class="parameter">pcp_server</replaceable></term>
+ <listitem>
+ <para>
+ The foreign server name for pcp server.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>Other arguments </option></term>
+ <listitem>
+ <para>
+ See <xref linkend="pcp-common-options">.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Example</title>
+ <para>
+ In the example below a search condition "connected" column = '1' is
+ specified, and only the information on the process connected from
+ clients. In this psql session pcp_proc_info is called in the from
+ clause, and the information is shown on row 1 and 2. The select
+ statement is sent to only backend_id = '0' (which is probably the
+ primary), and the "status" column of the row 1 is "Execute
+ command", the "statement" column shows the select statement which
+ was executed. On the other hand the "statement" column of the row 2
+ is empty, since the select statement is was not sent to backend_id
+ = '1'.
+ </para>
+ <para>
+ The information on the other psql session is shown on the row 2 and
+ 3. In this example "select 1" was sent to "backend_id" = '1'
+ (probably standby).
+ <programlisting>
+test=# select * from pcp_proc_info(host => '', port => 11001, username => 't-ishii', password => 't-ishii') where connected = '1';
+-[ RECORD 1 ]-------------+----------------------------------------------------------------------------------------------------------------------------
+database | test
+username | t-ishii
+start_time | 2025-02-22 20:56:08
+client_connection_count | 0
+major | 3
+minor | 0
+backend_connection_time | 2025-02-22 20:58:37
+client_connection_time | 2025-02-22 20:58:37
+client_idle_duration | 0
+client_disconnection_time |
+pool_counter | 1
+backend_pid | 14750
+connected | 1
+pid | 14585
+backend_id | 0
+status | Execute command
+load_balance_node | 1
+client_host | 127.0.0.1
+client_port | 59120
+statement | select * from pcp_proc_info(host => '', port => 11001, username => 't-ishii', password => 't-ishii') where connected = '1';
+-[ RECORD 2 ]-------------+----------------------------------------------------------------------------------------------------------------------------
+database | test
+username | t-ishii
+start_time | 2025-02-22 20:56:08
+client_connection_count | 0
+major | 3
+minor | 0
+backend_connection_time | 2025-02-22 20:58:37
+client_connection_time | 2025-02-22 20:58:37
+client_idle_duration | 0
+client_disconnection_time |
+pool_counter | 1
+backend_pid | 14751
+connected | 1
+pid | 14585
+backend_id | 1
+status | Execute command
+load_balance_node | 0
+client_host | 127.0.0.1
+client_port | 59120
+statement |
+-[ RECORD 3 ]-------------+----------------------------------------------------------------------------------------------------------------------------
+database | test
+username | t-ishii
+start_time | 2025-02-22 20:56:08
+client_connection_count | 0
+major | 3
+minor | 0
+backend_connection_time | 2025-02-22 20:58:56
+client_connection_time | 2025-02-22 20:58:56
+client_idle_duration | 0
+client_disconnection_time |
+pool_counter | 1
+backend_pid | 14767
+connected | 1
+pid | 14601
+backend_id | 0
+status | Idle
+load_balance_node | 0
+client_host | 127.0.0.1
+client_port | 54072
+statement |
+-[ RECORD 4 ]-------------+----------------------------------------------------------------------------------------------------------------------------
+database | test
+username | t-ishii
+start_time | 2025-02-22 20:56:08
+client_connection_count | 0
+major | 3
+minor | 0
+backend_connection_time | 2025-02-22 20:58:56
+client_connection_time | 2025-02-22 20:58:56
+client_idle_duration | 0
+client_disconnection_time |
+pool_counter | 1
+backend_pid | 14768
+connected | 1
+pid | 14601
+backend_id | 1
+status | Idle
+load_balance_node | 1
+client_host | 127.0.0.1
+client_port | 54072
+statement | select 1;
+ </programlisting>
+ </para>
+ <para>
+ In the example below we define a function called
+ "pgpool_query_info" which shows last executed query in each pgpool
+ child process along with associated information: usernae, database,
+ client host, client port, pgpool host, pgpool port, pgpool pid,
+ backend host, backend port, backend pid, backend role and SQL
+ statement, by joining pgpool_adm_pcp_proc_info,
+ pgpool_adm_pcp_node_info and pgpool_adm_pcp_pool_status.
+ <programlisting>
+create function pgpool_query_info(pcp_host text, pcp_port int, pgpool_username text, password text)
+returns table (username text, database text, client_host text, client_port text,
+pgpool_host text, pgpool_port text, pgpool_pid text,
+backend_host text, backend_port text, backend_pid text, backend_role text, statement text) as $$
+select p.username, p.database, p.client_host,p.client_port,
+$1 as pgpool_host, s.value as pgpool_port, p.pid as pgpool_pid,
+b.host as backend_host, b.port as backend_port, p.backend_pid as backend_pid,
+b.role as backend_role,
+p.statement
+from pcp_proc_info(host=> $1, port => $2, username => $3, password => $4) as p,
+pcp_node_info(node_id=>p.backend_id::int, host => $1, port => $2,
+username => $3, password => $4) as b,
+pcp_pool_status(host=> $1, port => $2, username => $3, password => $4) as s
+where p.connected = 1::text and p.statement != '' and
+p.statement !~ 'pcp_proc_info' and p.statement !~ 'pgpool_query_info' and
+s.item = 'port'
+$$
+language SQL;
+CREATE FUNCTION
+
+select * from pgpool_query_info('192.168.10.11', 11001, 't-ishii', 't-ishii');
+ username | database | client_host | client_port | pgpool_host | pgpool_port | pgpool_pid | backend_host | backend_port | backend_pid | backend_role | statement
+----------+----------+---------------+-------------+---------------+-------------+------------+--------------+--------------+-------------+--------------+-----------
+ t-ishii | test | 192.168.10.11 | 60542 | 192.168.10.11 | 11000 | 1356156 | localhost | 11002 | 1356240 | Primary | select 2;
+ t-ishii | test | 192.168.10.11 | 43856 | 192.168.10.11 | 11000 | 1356167 | localhost | 11003 | 1356255 | Standby | select 1;
+(2 rows)
+ </programlisting>
+ </para>
+ <para>
+ See <xref linkend="pcp-proc-info"> for more information on each
+ shown data.
+ </para>
+
+ </refsect1>
+
+</refentry>
<productname>Pgpool-II</productname>
</para>
<para>
- It has 17 columns:
+ It has 20 columns:
<itemizedlist>
<listitem>
<para>
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>
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
-----------+---------------------+-------------------------+---------+------------+----------+----------+-------------------------+------------------------+---------------------------+----------------------+--------------+--------------+--------------+-----------------+----------------+---------------------+-------------------
- 641408 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641408 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641409 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641410 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641411 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 0 | 0 | test | t-ishii | 2023-07-10 13:20:56 | 2023-07-10 13:20:56 | | 0 | 3 | 0 | 1 | 641448 | 1 | Idle | 1
- 641412 | 2023-07-10 13:20:51 | 0 | 0 | 1 | test | t-ishii | 2023-07-10 13:20:56 | 2023-07-10 13:20:56 | | 0 | 3 | 0 | 1 | 641449 | 1 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641412 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641413 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641414 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 0 | 0 | test | t-ishii | 2023-07-10 13:21:04 | 2023-07-10 13:21:04 | | 0 | 3 | 0 | 1 | 641455 | 1 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 0 | 1 | test | t-ishii | 2023-07-10 13:21:04 | 2023-07-10 13:21:04 | | 0 | 3 | 0 | 1 | 641456 | 1 | Execute command | 1
- 641415 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641415 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641416 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641417 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641418 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641419 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641420 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641421 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641422 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
- 641423 | 2023-07-10 13:20:51 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection | 0
-(128 rows)
+ 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>
&pgpoolAdmPcpNodeCount
&pgpoolAdmPcpAttachNode
&pgpoolAdmPcpDetachNode
+ &pgpoolAdmPcpProcInfo
</reference>
sql/pgpool_adm/pgpool_adm--1.3--1.4.sql \
sql/pgpool_adm/pgpool_adm--1.5.sql \
sql/pgpool_adm/pgpool_adm--1.4--1.5.sql \
+ sql/pgpool_adm/pgpool_adm--1.6.sql \
+ sql/pgpool_adm/pgpool_adm--1.5--1.6.sql \
sql/pgpool_adm/Makefile \
test/parser/expected/copy.out test/parser/expected/create.out \
test/parser/expected/cursor.out test/parser/expected/delete.out \
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2024 PgPool Global Development Group
+ * Copyright (c) 2003-2025 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
#ifndef LIBPCP_EXT_H
#define LIBPCP_EXT_H
+#include <netdb.h>
+
#include <signal.h>
#include <stdio.h>
#include "parser/pg_config_manual.h"
#endif
+/* returns number of bits in the data type or variable */
+#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
+
/*
* startup packet definitions (v2) stolen from PostgreSQL
*/
* process information
* This object put on shared memory.
*/
+
+#define MAXSTMTLEN 1024
+
typedef struct
{
pid_t pid; /* OS's process id */
* this process */
int client_connection_count; /* how many times clients used this process */
ProcessStatus status;
+ char client_host[NI_MAXHOST]; /* client host. Only valid if status != WAIT_FOR_CONNECT */
+ char client_port[NI_MAXSERV]; /* client port. Only valid if status != WAIT_FOR_CONNECT */
+ char statement[MAXSTMTLEN]; /* the last statement sent to backend */
+ uint64 node_ids[2]; /* "statement" is sent to the node id (bitmap) */
bool need_to_restart; /* If non 0, exit this child process as
* soon as current session ends. Typical
* case this flag being set is failback a
char pool_connected[POOLCONFIG_MAXCOUNTLEN + 1];
char status[POOLCONFIG_MAXPROCESSSTATUSLEN + 1];
char load_balance_node[POOLCONFIG_MAXPROCESSSTATUSLEN + 1];
+ char client_host[NI_MAXHOST];
+ char client_port[NI_MAXSERV];
+ char statement[MAXSTMTLEN];
} POOL_REPORT_POOLS;
/* version struct */
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2024 PgPool Global Development Group
+ * Copyright (c) 2003-2025 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
extern char per_node_error_log(POOL_CONNECTION_POOL * backend, int node_id,
char *query, char *prefix, bool unread);
+extern void init_pi_set(void);
+extern void pi_set(int node_id);
+extern bool is_pi_set(uint64 *node_ids, int node_id);
+
#endif
AM_CPPFLAGS = -D_GNU_SOURCE -DPOOL_PRIVATE -I @PGSQL_INCLUDE_DIR@
lib_LTLIBRARIES = libpcp.la
-libpcp_la_LDFLAGS = -version-info 2:0:0
+libpcp_la_LDFLAGS = -version-info 2:1:0
dist_libpcp_la_SOURCES = pcp.c \
../../utils/pool_path.c \
../../tools/fe_port.c \
../../tools/fe_memutils.c \
../../utils/strlcpy.c \
- ../../utils/pool_health_check_stats.c
+ ../../utils/pool_health_check_stats.c \
+ ../../utils/sprompt.c
+
nodist_libpcp_la_SOURCES = pcp_stream.c \
md5.c \
json.c
get_connection(int front_end_fd, SockAddr *saddr)
{
POOL_CONNECTION *cp;
+ ProcessInfo *pi;
ereport(DEBUG1,
(errmsg("I am %d accept fd %d", getpid(), front_end_fd)));
pool_getnameinfo_all(saddr, remote_host, remote_port);
+
+ /* save remote client host and port info onto shared memory */
+ pi = pool_get_my_process_info();
+ StrNCpy(pi->client_host, remote_host, NI_MAXHOST);
+ StrNCpy(pi->client_port, remote_port, NI_MAXSERV);
+
print_process_status(remote_host, remote_port);
set_ps_display("accept connection", false);
*/
pool_start_query(query_context, contents, len, node);
+ /*
+ * Initialize ProcessInfo->node_ids and ProcessInfo->statement.
+ */
+ init_pi_set();
+
/*
* Check if the transaction is in abort status. If so, we do nothing
* and just return an error message to frontend, execpt for
session_context->uncompleted_message = NULL;
}
+ /* initialize backend send statement bitmap */
+ init_pi_set();
if (!RAW_MODE)
{
/* check if query is "COMMIT" or "ROLLBACK" */
commit = is_commit_or_rollback_query(node);
+ /* initialize backend send statement bitmap */
+ init_pi_set();
+
if (!SL_MODE)
{
/*
void
per_node_statement_log(POOL_CONNECTION_POOL * backend, int node_id, char *query)
{
+ ProcessInfo *pi = pool_get_my_process_info();
POOL_CONNECTION_POOL_SLOT *slot = backend->slots[node_id];
if (pool_config->log_per_node_statement)
ereport(LOG,
(errmsg("DB node id: %d backend pid: %d statement: %s", node_id, ntohl(slot->pid), query)));
+
+ pi_set(node_id);
+ StrNCpy(pi->statement, query, MAXSTMTLEN);
+}
+
+/*
+ * Initialize ProcessInfo->node_ids and ProcessInfo->statement.
+ */
+void
+init_pi_set(void)
+{
+ ProcessInfo *pi = pool_get_my_process_info();
+
+ memset(pi->node_ids, 0, sizeof(pi->node_ids));
+ pi->statement[0] = '\0';
+}
+
+/*
+ * Set ProcessInfo->node_ids.
+ */
+void
+pi_set(int node_id)
+{
+ ProcessInfo *pi = pool_get_my_process_info();
+
+ if (node_id < BITS_PER_TYPE(uint64))
+ pi->node_ids[0] |= (1 << node_id);
+ else
+ pi->node_ids[1] |= (1 << (node_id - BITS_PER_TYPE(uint64)));
+}
+
+/*
+ * Returns true if node_id bit in ProcessInfo->node_ids is on.
+ */
+bool
+is_pi_set(uint64 *node_ids, int node_id)
+{
+ int set;
+
+ if (node_id < BITS_PER_TYPE(uint64))
+ set = node_ids[0] & (1 << node_id);
+ else
+ set = node_ids[1] & (1 << (node_id - BITS_PER_TYPE(uint64)));
+ return set != 0;
}
/*
DATA = pgpool_adm--1.0.sql pgpool_adm--1.1.sql pgpool_adm--1.2.sql pgpool_adm--1.3.sql \
pgpool_adm--1.0--1.1.sql pgpool_adm--1.1--1.2.sql pgpool_adm--1.2--1.3.sql \
pgpool_adm--1.4.sql pgpool_adm--1.3--1.4.sql \
-pgpool_adm--1.5.sql pgpool_adm--1.4--1.5.sql
+pgpool_adm--1.5.sql pgpool_adm--1.4--1.5.sql \
+pgpool_adm--1.6.sql pgpool_adm--1.5--1.6.sql
SHLIB_LINK = -L../../libs/pcp/.libs -lpcp -Wl,--as-needed -Wl,-rpath,'${prefix}/lib',--enable-new-dtags
# if you are using PostgreSQL 8.0 or later,
# using pg_config is recommended.
--- /dev/null
+/* contrib/pgpool_adm/pgpool_adm--1.5--1.6.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION pgpool_adm UPDATE TO '1.6'" to load this file. \quit
+
+/**
+ * input parameters: node_id, host, port, username, password
+ */
+CREATE FUNCTION pcp_proc_info(IN host text, IN port integer, IN username text, IN password text,
+OUT database text,
+OUT username text,
+OUT start_time text,
+OUT client_connection_count text,
+OUT major text,
+OUT minor text,
+OUT backend_connection_time text,
+OUT client_connection_time text,
+OUT client_idle_duration text,
+OUT client_disconnection_time text,
+OUT pool_counter text,
+OUT backend_pid text,
+OUT connected text,
+OUT pid text,
+OUT backend_id text,
+OUT status text,
+OUT load_balance_node text,
+OUT client_host text,
+OUT client_port text,
+OUT statement text)
+RETURNS SETOF record
+AS 'MODULE_PATHNAME', '_pcp_proc_info'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, pcp_server
+ */
+CREATE FUNCTION pcp_proc_info(IN pcp_server text,
+OUT database text,
+OUT username text,
+OUT start_time text,
+OUT client_connection_count text,
+OUT major text,
+OUT minor text,
+OUT backend_connection_time text,
+OUT client_connection_time text,
+OUT client_idle_duration text,
+OUT client_disconnection_time text,
+OUT pool_counter text,
+OUT backend_pid text,
+OUT connected text,
+OUT pid text,
+OUT backend_id text,
+OUT status text,
+OUT load_balance_node text,
+OUT client_host text,
+OUT client_port text,
+OUT statement text)
+RETURNS SETOF record
+AS 'MODULE_PATHNAME', '_pcp_proc_info'
+LANGUAGE C VOLATILE STRICT;
+
--- /dev/null
+/* contrib/pgpool_adm/pgpool_adm--1.6.sql */
+
+/* ***********************************************
+ * Administrative functions for pgPool
+ * *********************************************** */
+
+/**
+ * input parameters: node_id, host, port, username, password
+ */
+CREATE FUNCTION pcp_node_info(IN node_id integer, IN host text, IN port integer, IN username text, IN password text, OUT host text, OUT port integer, OUT status text, OUT pg_status text, OUT weight float4, OUT role text, OUT pg_role text, OUT replication_delay bigint, OUT replication_state text, OUT replication_sync_state text, OUT last_status_change timestamp)
+RETURNS record
+AS 'MODULE_PATHNAME', '_pcp_node_info'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, pcp_server
+ */
+CREATE FUNCTION pcp_node_info(IN node_id integer, IN pcp_server text, OUT host text, OUT port integer, OUT status text, OUT weight float4)
+RETURNS record
+AS 'MODULE_PATHNAME', '_pcp_node_info'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, host, port, username, password
+ */
+CREATE FUNCTION pcp_health_check_stats(IN node_id integer, IN host text, IN port integer, IN username text, IN password text, OUT node_id integer, OUT host text, OUT port integer, OUT status text, OUT role text, OUT last_status_change timestamp, OUT total_count bigint, OUT success_count bigint, OUT fail_count bigint, OUT skip_count bigint, OUT retry_count bigint, OUT average_retry_count float4, OUT max_retry_count bigint, OUT max_health_check_duration bigint, OUT min_health_check_duration bigint, OUT average_health_check_duration float4, OUT last_health_check timestamp, OUT last_successful_health_check timestamp, OUT last_skip_health_check timestamp, OUT last_failed_health_check timestamp)
+RETURNS record
+AS 'MODULE_PATHNAME', '_pcp_health_check_stats'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, pcp_server
+ */
+CREATE FUNCTION pcp_health_check_stats(IN node_id integer, IN pcp_server text, OUT host text, OUT port integer, OUT status text, OUT weight float4)
+RETURNS record
+AS 'MODULE_PATHNAME', '_pcp_health_check_stats'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: host, port, username, password
+ */
+CREATE FUNCTION pcp_pool_status(IN host text, IN port integer, IN username text, IN password text, OUT item text, OUT value text, OUT description text)
+RETURNS SETOF record
+AS 'MODULE_PATHNAME', '_pcp_pool_status'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: pcp_server
+ */
+CREATE FUNCTION pcp_pool_status(IN pcp_server text, OUT item text, OUT value text, OUT description text)
+RETURNS SETOF record
+AS 'MODULE_PATHNAME', '_pcp_pool_status'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: host, port, username, password
+ */
+CREATE FUNCTION pcp_node_count(IN host text, IN port integer, IN username text, IN password text, OUT node_count integer)
+RETURNS integer
+AS 'MODULE_PATHNAME', '_pcp_node_count'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: pcp_server
+ */
+CREATE FUNCTION pcp_node_count(IN pcp_server text, OUT node_count integer)
+RETURNS integer
+AS 'MODULE_PATHNAME', '_pcp_node_count'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, host, port, username, password
+ */
+CREATE FUNCTION pcp_attach_node(IN node_id integer, IN host text, IN port integer, IN username text, IN password text, OUT node_attached boolean)
+RETURNS boolean
+AS 'MODULE_PATHNAME', '_pcp_attach_node'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, pcp_server
+ */
+CREATE FUNCTION pcp_attach_node(IN node_id integer, IN pcp_server text, OUT node_attached boolean)
+RETURNS boolean
+AS 'MODULE_PATHNAME', '_pcp_attach_node'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, gracefully, host, port, username, password
+ */
+CREATE FUNCTION pcp_detach_node(IN node_id integer, IN gracefully boolean, IN host text, IN port integer, IN username text, IN password text, OUT node_detached boolean)
+RETURNS boolean
+AS 'MODULE_PATHNAME', '_pcp_detach_node'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, gracefully, pcp_server
+ */
+CREATE FUNCTION pcp_detach_node(IN node_id integer, IN gracefully boolean, IN pcp_server text, OUT node_detached boolean)
+RETURNS boolean
+AS 'MODULE_PATHNAME', '_pcp_detach_node'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, host, port, username, password
+ */
+CREATE FUNCTION pcp_proc_info(IN host text, IN port integer, IN username text, IN password text,
+OUT database text,
+OUT username text,
+OUT start_time text,
+OUT client_connection_count text,
+OUT major text,
+OUT minor text,
+OUT backend_connection_time text,
+OUT client_connection_time text,
+OUT client_idle_duration text,
+OUT client_disconnection_time text,
+OUT pool_counter text,
+OUT backend_pid text,
+OUT connected text,
+OUT pid text,
+OUT backend_id text,
+OUT status text,
+OUT load_balance_node text,
+OUT client_host text,
+OUT client_port text,
+OUT statement text)
+RETURNS SETOF record
+AS 'MODULE_PATHNAME', '_pcp_proc_info'
+LANGUAGE C VOLATILE STRICT;
+
+/**
+ * input parameters: node_id, pcp_server
+ */
+CREATE FUNCTION pcp_proc_info(IN pcp_server text,
+OUT database text,
+OUT username text,
+OUT start_time text,
+OUT client_connection_count text,
+OUT major text,
+OUT minor text,
+OUT backend_connection_time text,
+OUT client_connection_time text,
+OUT client_idle_duration text,
+OUT client_disconnection_time text,
+OUT pool_counter text,
+OUT backend_pid text,
+OUT connected text,
+OUT pid text,
+OUT backend_id text,
+OUT status text,
+OUT load_balance_node text,
+OUT client_host text,
+OUT client_port text,
+OUT statement text)
+RETURNS SETOF record
+AS 'MODULE_PATHNAME', '_pcp_proc_info'
+LANGUAGE C VOLATILE STRICT;
+
Int32GetDatum(-1))));
}
+/**
+ * host_or_srv: server name or ip address of the pgpool server
+ * port: pcp port number
+ * user: user to connect with
+ * pass: password
+ **/
+Datum
+_pcp_proc_info(PG_FUNCTION_ARGS)
+{
+ MemoryContext oldcontext;
+ FuncCallContext *funcctx;
+ int32 nrows;
+ int32 call_cntr;
+ int32 max_calls;
+ AttInMetadata *attinmeta;
+ PCPConnInfo *pcpConnInfo;
+ PCPResultInfo *pcpResInfo;
+
+ int an;
+
+#define NUM_COLS 20 /* number of columns */
+
+ /* stuff done only on the first call of the function */
+ if (SRF_IS_FIRSTCALL())
+ {
+ TupleDesc tupdesc;
+ char *host_or_srv = text_to_cstring(PG_GETARG_TEXT_PP(0));
+
+ /* create a function context for cross-call persistence */
+ funcctx = SRF_FIRSTCALL_INIT();
+
+ /* switch to memory context appropriate for multiple function calls */
+ oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
+
+ if (PG_NARGS() == 4)
+ {
+ char *user,
+ *pass;
+ int port;
+
+ port = PG_GETARG_INT16(1);
+ user = text_to_cstring(PG_GETARG_TEXT_PP(2));
+ pass = text_to_cstring(PG_GETARG_TEXT_PP(3));
+ pcpConnInfo = connect_to_server(host_or_srv, port, user, pass);
+ }
+ else if (PG_NARGS() == 1)
+ pcpConnInfo = connect_to_server_from_foreign_server(host_or_srv);
+ else
+ {
+ MemoryContextSwitchTo(oldcontext);
+ ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("Wrong number of argument.")));
+ }
+
+ pcpResInfo = pcp_process_info(pcpConnInfo, 0);
+ if (pcpResInfo == NULL || PCPResultStatus(pcpResInfo) != PCP_RES_COMMAND_OK)
+ {
+ char *error = pcp_get_last_error(pcpConnInfo) ? pstrdup(pcp_get_last_error(pcpConnInfo)) : NULL;
+
+ pcp_disconnect(pcpConnInfo);
+ pcp_free_connection(pcpConnInfo);
+
+ MemoryContextSwitchTo(oldcontext);
+ ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
+ errmsg("failed to get pool status"),
+ errdetail("%s\n", error ? error : "unknown reason")));
+ }
+
+ nrows = pcp_result_slot_count(pcpResInfo);
+ pcp_disconnect(pcpConnInfo);
+ /* Construct a tuple descriptor for the result rows */
+#if defined(PG_VERSION_NUM) && (PG_VERSION_NUM >= 120000)
+ tupdesc = CreateTemplateTupleDesc(NUM_COLS);
+#else
+ tupdesc = CreateTemplateTupleDesc(NUM_COLS, false);
+#endif
+ an = 1;
+ TupleDescInitEntry(tupdesc, an++, "database", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "username", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "start_time", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "client_connection_count", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "major", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "minor", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "backend_connection_time", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "client_connection_time", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "client_idle_duration", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "client_disconnection_time", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "pool_counter", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "backend_pid", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "connected", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "pid", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "backend_id", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "status", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "load_balance_node", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "client_host", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "client_port", TEXTOID, -1, 0);
+ TupleDescInitEntry(tupdesc, an++, "statement", TEXTOID, -1, 0);
+
+ /*
+ * Generate attribute metadata needed later to produce tuples from raw
+ * C strings
+ */
+ attinmeta = TupleDescGetAttInMetadata(tupdesc);
+ funcctx->attinmeta = attinmeta;
+
+ if (nrows > 0)
+ {
+ funcctx->max_calls = nrows;
+
+ /* got results, keep track of them */
+ funcctx->user_fctx = pcpConnInfo;
+ }
+ else
+ {
+ /* fast track when no results */
+ MemoryContextSwitchTo(oldcontext);
+ SRF_RETURN_DONE(funcctx);
+ }
+
+ MemoryContextSwitchTo(oldcontext);
+ }
+
+ /* stuff done on every call of the function */
+ funcctx = SRF_PERCALL_SETUP();
+
+ /* initialize per-call variables */
+ call_cntr = funcctx->call_cntr;
+ max_calls = funcctx->max_calls;
+
+ pcpConnInfo = (PCPConnInfo *) funcctx->user_fctx;
+ pcpResInfo = (PCPResultInfo *) pcpConnInfo->pcpResInfo;
+ attinmeta = funcctx->attinmeta;
+
+ if (call_cntr < max_calls) /* executed while there is more left to send */
+ {
+ char *values[NUM_COLS];
+ HeapTuple tuple;
+ Datum result;
+ int i = 0;
+ POOL_REPORT_POOLS *pools = (POOL_REPORT_POOLS *) pcp_get_binary_data(pcpResInfo, call_cntr);
+
+ values[i++] = pstrdup(pools->database);
+ values[i++] = pstrdup(pools->username);
+ values[i++] = pstrdup(pools->process_start_time);
+ values[i++] = pstrdup(pools->client_connection_count);
+ values[i++] = pstrdup(pools->pool_majorversion);
+ values[i++] = pstrdup(pools->pool_minorversion);
+ values[i++] = pstrdup(pools->backend_connection_time);
+ values[i++] = pstrdup(pools->client_connection_time);
+ values[i++] = pstrdup(pools->client_idle_duration);
+ values[i++] = pstrdup(pools->client_disconnection_time);
+ values[i++] = pstrdup(pools->pool_counter);
+ values[i++] = pstrdup(pools->pool_backendpid);
+ values[i++] = pstrdup(pools->pool_connected);
+ values[i++] = pstrdup(pools->pool_pid);
+ values[i++] = pstrdup(pools->backend_id);
+ values[i++] = pstrdup(pools->status);
+ values[i++] = pstrdup(pools->load_balance_node);
+ values[i++] = pstrdup(pools->client_host);
+ values[i++] = pstrdup(pools->client_port);
+ values[i++] = pstrdup(pools->statement);
+
+ /* build the tuple */
+ tuple = BuildTupleFromCStrings(attinmeta, values);
+
+ /* make the tuple into a datum */
+ result = HeapTupleGetDatum(tuple);
+
+ SRF_RETURN_NEXT(funcctx, result);
+ }
+ else
+ {
+ /* do when there is no more left */
+ pcp_free_connection(pcpConnInfo);
+ SRF_RETURN_DONE(funcctx);
+ }
+}
# pcp extension
comment = 'Administrative functions for pgPool'
-default_version = '1.5'
+default_version = '1.6'
module_pathname = '$libdir/pgpool_adm'
relocatable = true
* pgpool_adm.h
*
*
- * Copyright (c) 2002-2018, PostgreSQL Global Development Group
+ * Copyright (c) 2002-2025, PostgreSQL Global Development Group
+ * Copyright (c) 2019-2025, PgPool Global Development Group
*
* Author: Jehan-Guillaume (ioguix) de Rorthais <jgdr@dalibo.com>
*
Datum _pcp_node_count(PG_FUNCTION_ARGS);
Datum _pcp_attach_node(PG_FUNCTION_ARGS);
Datum _pcp_detach_node(PG_FUNCTION_ARGS);
+Datum _pcp_proc_info(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(_pcp_node_info);
PG_FUNCTION_INFO_V1(_pcp_health_check_stats);
PG_FUNCTION_INFO_V1(_pcp_node_count);
PG_FUNCTION_INFO_V1(_pcp_attach_node);
PG_FUNCTION_INFO_V1(_pcp_detach_node);
+PG_FUNCTION_INFO_V1(_pcp_proc_info);
#endif
--- /dev/null
+CREATE EXTENSION pgpool_adm;
+CREATE EXTENSION
+SELECT database, status, client_host, statement FROM pcp_proc_info
+(host => '', port => 11001, username => 't-ishii', password => 't-ishii')
+WHERE connected = '1' AND backend_id = '0' AND statement = 'SELECT pg_sleep(1)'
+ database | status | client_host | statement
+----------+-----------------+-------------+--------------------
+ test | Execute command | 127.0.0.1 | SELECT pg_sleep(1)
+(1 row)
+
fi
fi
+#
+# test for pcp_proc_info, pgpool_adm: pcp_proc_info
+WHOAMI=`whoami`
+./shutdownall
+./startall
+wait_for_pgpool_startup
+$PSQL -a -h localhost -c "SELECT pg_sleep(1)" test &
+$PSQL -a -h localhost test > result 2>&1 <<EOF
+CREATE EXTENSION pgpool_adm;
+SELECT database, status, client_host, statement FROM pcp_proc_info
+(host => '', port => $PCP_PORT, username => '$WHOAMI', password => '$WHOAMI')
+WHERE connected = '1' AND backend_id = '0' AND statement = 'SELECT pg_sleep(1)'
+EOF
+if [ $? != 0 ];then
+ r2=fail
+ echo "test2 failed"
+else
+ cmp ../expected result
+ if [ $? != 0 ];then
+ r2=fail
+ echo "test2 failed"
+ else
+ r2=ok
+ fi
+fi
+wait
./shutdownall
-if [ $r1 = ok ]; then
+if [ $r1 = ok -a $r2 = ok ]; then
echo "all test succeeded"
exit 0
else
echo "some tests failed"
echo "test1: $r1"
+ echo "test2: $r2"
exit 1
fi
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2024 PgPool Global Development Group
+ * Copyright (c) 2003-2025 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
"Database", "Username", "Start time", "Client connection count",
"Major", "Minor", "Backend connection time", "Client connection time",
"Client idle duration", "Client disconnection time", "Pool Counter", "Backend PID",
- "Connected", "PID", "Backend ID", "Status", "Load balance node"
+ "Connected", "PID", "Backend ID", "Status", "Load balance node",
+ "client_host", "client_port", "statement"
};
const char *types[] = {
"s", "s", "s", "s",
"s", "s", "s", "s",
"s", "s", "s", "s",
"s", "s", "s", "s",
- "s"
+ "s", "s", "s", "s"
};
format = format_titles(titles, types, sizeof(titles)/sizeof(char *));
else
{
- format = "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n";
+ format = "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n";
}
for (i = 0; i < array_size; i++)
pools->pool_pid,
pools->backend_id,
pools->status,
- pools->load_balance_node);
+ pools->load_balance_node,
+ pools->client_host,
+ pools->client_port,
+ pools->statement);
}
if (printed == false)
printf("No process information available\n\n");
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2021 PgPool Global Development Group
+ * Copyright (c) 2003-2025 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
offsetof(POOL_REPORT_POOLS, pool_backendpid),
offsetof(POOL_REPORT_POOLS, pool_connected),
offsetof(POOL_REPORT_POOLS, status),
- offsetof(POOL_REPORT_POOLS, load_balance_node)
+ offsetof(POOL_REPORT_POOLS, load_balance_node),
+ offsetof(POOL_REPORT_POOLS, client_host),
+ offsetof(POOL_REPORT_POOLS, client_port),
+ offsetof(POOL_REPORT_POOLS, statement)
};
*n = sizeof(offsettbl)/sizeof(int);
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2024 PgPool Global Development Group
+ * Copyright (c) 2003-2025 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
StrNCpy(pools[lines].load_balance_node, "1", POOLCONFIG_MAXPROCESSSTATUSLEN);
else
StrNCpy(pools[lines].load_balance_node, "0", POOLCONFIG_MAXPROCESSSTATUSLEN);
+
+ StrNCpy(pools[lines].client_host, pi->client_host, NI_MAXHOST);
+ StrNCpy(pools[lines].client_port, pi->client_port, NI_MAXSERV);
+
+ /*
+ * If this the statement was sent to backend id
+ * report the statement.
+ */
+ if (is_pi_set(pi->node_ids, backend_id))
+ {
+ StrNCpy(pools[lines].statement, pi->statement, MAXSTMTLEN);
+ elog(LOG, "pi->node_ids[0]:%ld pi->node_ids[1]:%ld",
+ pi->node_ids[0], pi->node_ids[1]);
+ }
lines++;
}
}
"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"};
+ "status", "load_balance_node", "client_host", "client_port", "statement"};
int n;
int *offsettbl;
int nrows;