<div dir="ltr">Just as follow-up:<div>all the idle connections are due to our strategy of id generation (very good explanation of the problem here --&gt; <a href="https://vladmihalcea.com/why-you-should-never-use-the-table-identifier-generator-with-jpa-and-hibernate/">https://vladmihalcea.com/why-you-should-never-use-the-table-identifier-generator-with-jpa-and-hibernate/</a>).</div><div>We changed the strategy using postgres sequences and all the idle connection were gone.</div><div>So it wasn&#39;t a problem of pgpool.</div><div><br></div><div>Best regards </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno sab 4 mag 2019 alle ore 23:44 Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>&gt; ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">&gt; I want to configure pgpool only as &quot;load balancer&quot; for the SQL queries.<br>
&gt; This is my scenario:<br>
&gt; - one application server with tomcat. For each server, there is a single<br>
&gt; user that makes the queries. The user is for example &quot;userApplication&quot;. I<br>
&gt; want to use the application connection pooling (c3p0).<br>
&gt; - a single node with pgpool installed configured to send R/W queries to the<br>
&gt; master and R only queries to the slaves.<br>
&gt; - a postgresql-cluster (postgresql-10) with one master node and one slave.<br>
&gt; <br>
&gt; I&#39;ve used the default configuration for pgpool (pgpool.conf.sample)<br>
&gt; changing only:<br>
&gt; *listen_addresses*<br>
&gt; *port*<br>
&gt; <br>
&gt; *backend_hostnameX*<br>
&gt; *backend_portX*<br>
&gt; *connection_cache = off*<br>
<br>
You&#39;d better to use pgpool.conf.sample-stream since you are<br>
configuring streaming replication cluster.<br>
<br>
&gt; So, in my understanding, setting connection_cache to off will disable the<br>
&gt; connection pooling. But there are too many idle connections on postgres<br>
&gt; opened by pgpool, so it seems that pgpool still open num_init_children.<br>
<br>
Because from Pgpool-II&#39;s point of view, your client (in your case<br>
tomcat&#39;s connection pooling) keeps on connecting to Pgpool-II. Until the<br>
client disconnects to Pgpool-II, it cannot close a connection to<br>
PostgreSQL.<br>
<br>
&gt; Moreover, if I correctly understand connections with the same user name,<br>
&gt; database, protocol version go to the same child process, so in my case, I&#39;m<br>
&gt; using only one of the child process and the others aren&#39;t used.<br>
<br>
No. See the FAQ entry which explains why:<br>
<a href="https://pgpool.net/mediawiki/index.php/FAQ#Why_max_connection_must_satisfy_this_formula_max_connection_.3E.3D_.28num_init_children_.2A_max_pool.29_and_not_max_connection_.3E.3D_num_init_children.3F" rel="noreferrer" target="_blank">https://pgpool.net/mediawiki/index.php/FAQ#Why_max_connection_must_satisfy_this_formula_max_connection_.3E.3D_.28num_init_children_.2A_max_pool.29_and_not_max_connection_.3E.3D_num_init_children.3F</a><br>
<br>
&gt; Is there a way to use pgPool to load balancing sql queries from the same<br>
&gt; user to a different child process?<br>
<br>
No.<br>
<br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Enzo Veltri</div>