<div dir="ltr"><br><div class="gmail_extra"><div><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Yes 100% sure I am manually pasting out the table name, there&#39;s 11 of them in less then 1 minute of logs, and that&#39;s just for 1 table.</div>
</div></div><br><div class="gmail_quote">On Wed, Dec 4, 2013 at 3:32 PM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Are you sure that those &quot;table&quot; are exactly the same one?<br>
<div class="HOEnZb"><div class="h5">--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; Ok I scanned the log again and found this:<br>
&gt;<br>
&gt; 2013-12-04 07:02:36 LOG:   pid 17148: DB node id: 0 backend pid: 6475<br>
&gt; statement: SELECT count(*) FROM pg_catalog.pg_class AS c WHERE c.relname =<br>
&gt; &#39;table&#39; AND c.relpersistence = &#39;u&#39;<br>
&gt; 2013-12-04 07:02:46 LOG:   pid 17148: DB node id: 0 backend pid: 6475<br>
&gt; statement: SELECT count(*) FROM pg_catalog.pg_class AS c WHERE c.relname =<br>
&gt; &#39;table&#39; AND c.relpersistence = &#39;u&#39;<br>
&gt; 2013-12-04 07:02:49 LOG:   pid 17148: DB node id: 0 backend pid: 6475<br>
&gt; statement: SELECT count(*) FROM pg_catalog.pg_class AS c WHERE c.relname =<br>
&gt; &#39;table&#39; AND c.relpersistence = &#39;u&#39;<br>
&gt;<br>
&gt; that looks like the same pid not caching.<br>
&gt;<br>
&gt; On Wed, Dec 4, 2013 at 3:21 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; The cache is per process base, not cluster wide.<br>
&gt;&gt;<br>
&gt;&gt; That means, unless you find an evidence that same pid process issues<br>
&gt;&gt; same catalog access more than once, it can be said that the cache is<br>
&gt;&gt; working.<br>
&gt;&gt; --<br>
&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt;<br>
&gt;&gt; &gt; I have just cut out some parts of the log, as it generates mbs of logs a<br>
&gt;&gt; &gt; minute as I believe this is what you want, as you can see it doesn&#39;t seem<br>
&gt;&gt; &gt; to be caching:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2013-12-04 07:02:19 LOG:   pid 17148: DB node id: 0 backend pid: 6475<br>
&gt;&gt; &gt; statement: SELECT count(*) FROM pg_catalog.pg_class AS c WHERE c.relname<br>
&gt;&gt; =<br>
&gt;&gt; &gt; &#39;table&#39; AND c.relpersistence = &#39;u&#39;<br>
&gt;&gt; &gt; 2013-12-04 07:02:19 LOG:   pid 17173: DB node id: 0 backend pid: 6463<br>
&gt;&gt; &gt; statement: SELECT count(*) FROM pg_catalog.pg_class AS c WHERE c.relname<br>
&gt;&gt; =<br>
&gt;&gt; &gt; &#39;table&#39; AND c.relpersistence = &#39;u&#39;<br>
&gt;&gt; &gt; 2013-12-04 07:02:19 LOG:   pid 17179: DB node id: 0 backend pid: 6462<br>
&gt;&gt; &gt; statement: SELECT count(*) FROM pg_catalog.pg_class AS c WHERE c.relname<br>
&gt;&gt; =<br>
&gt;&gt; &gt; &#39;table&#39; AND c.relpersistence = &#39;u&#39;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; let me know if this is not what you wanted, we are currently using<br>
&gt;&gt; pgpool:<br>
&gt;&gt; &gt; 3.3.0 with postgres 9.1<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; *Nathan Brennan* *BCS*<br>
&gt;&gt; &gt; Lead Developer<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; *T:* +61 8 9482 3981 | *E:* <a href="mailto:nathan@healthengine.com.au">nathan@healthengine.com.au</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &lt;<a href="http://healthengine.com.au/" target="_blank">http://healthengine.com.au/</a>&gt;      &lt;<a href="https://twitter.com/healthengine" target="_blank">https://twitter.com/healthengine</a>&gt;<br>

&gt;&gt; &gt; &lt;<a href="https://www.facebook.com/HealthEngine" target="_blank">https://www.facebook.com/HealthEngine</a>&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Wed, Dec 4, 2013 at 2:40 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; ok thanks,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I have disabled the check_temp_table as we don&#39;t use temp tables which<br>
&gt;&gt; &gt;&gt; &gt; removes the pg_temp queries, however there is still alot of queries<br>
&gt;&gt; for<br>
&gt;&gt; &gt;&gt; &gt; SELECT count(*) FROM pg_catalog.pg_class AS c WHERE c.relname =<br>
&gt;&gt; &#39;table&#39;<br>
&gt;&gt; &gt;&gt; AND<br>
&gt;&gt; &gt;&gt; &gt; c.relpersistence = &#39;u&#39; to me this seems like a check to see if the<br>
&gt;&gt; table<br>
&gt;&gt; &gt;&gt; &gt; exists, is there a way to cache this ?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I thought this one is cached. Can you show me pgpool.log with<br>
&gt;&gt; &gt;&gt; log_per_node_statement enabled?<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; *Nathan Brennan* *BCS*<br>
&gt;&gt; &gt;&gt; &gt; Lead Developer<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; *T:* <a href="tel:%2B61%208%209482%203981" value="+61894823981">+61 8 9482 3981</a> | *E:* <a href="mailto:nathan@healthengine.com.au">nathan@healthengine.com.au</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; &lt;<a href="http://healthengine.com.au/" target="_blank">http://healthengine.com.au/</a>&gt;      &lt;<a href="https://twitter.com/healthengine" target="_blank">https://twitter.com/healthengine</a>&gt;<br>

&gt;&gt; &gt;&gt; &gt; &lt;<a href="https://www.facebook.com/HealthEngine" target="_blank">https://www.facebook.com/HealthEngine</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; On Wed, Dec 4, 2013 at 12:51 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Is there a way to cache these queries or turn them off as pgpool is<br>
&gt;&gt; &gt;&gt; doing<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; thousands of them a second.I tried setting relcache_expire=60 but<br>
&gt;&gt; it<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; doesn&#39;t seem to help.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; example queries:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; SELECT count(*) FROM pg_class AS c, pg_namespace AS n WHERE<br>
&gt;&gt; c.relname<br>
&gt;&gt; &gt;&gt; =<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; &#39;table&#39; AND c.relnamespace = n.oid AND n.nspname = &#39;pg_catalog&#39;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;  SELECT count(*) FROM pg_class AS c, pg_namespace AS n WHERE<br>
&gt;&gt; &gt;&gt; c.relname =<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; &#39;table&#39; AND c.relnamespace = n.oid AND n.nspname ~ &#39;^pg_temp_&#39;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; You can avoid temp table related queries by turning check_temp_table<br>
&gt;&gt; &gt;&gt; &gt;&gt; to off (of course you need to be sure that you are not using temp<br>
&gt;&gt; &gt;&gt; &gt;&gt; tables).<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Also relcache_expire = 0 will be more effective if you want to reduce<br>
&gt;&gt; &gt;&gt; &gt;&gt; the number of queries.<br>
&gt;&gt; &gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt;<br>
</div></div></blockquote></div><br></div></div>