<div dir="ltr"><div dir="ltr"><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><br><div><span style="color:rgb(153,153,153)">Rick Morris | Managing Consultant, Professional Services &amp; Training (EMEA) | M</span><span style="color:rgb(153,153,153);font-size:12.8px">: +1 954 224 8682 | </span><span style="color:rgb(153,153,153);font-size:12.8px">Skype: rycamor</span><br></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 27, 2020 at 1:24 AM Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>&gt; wrote:<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;&gt; Currently there&#39;s no such functionality in Pgpool-II. It&#39;s a technical<br>
&gt;&gt; challenge for Pgpool-II because there&#39;s no way for Pgpool-II to know<br>
&gt;&gt; what table(s) are modified inside the function.<br>
&gt; <br>
&gt; <br>
&gt; Yes, I figured that was a serious challenge.<br>
&gt; <br>
&gt; <br>
&gt;&gt; To implement such<br>
&gt;&gt; functionality, Pgpool-II needs to know:<br>
&gt;&gt;<br>
&gt;&gt; 1) whether the SELECT modifies tables or not.<br>
&gt;&gt;<br>
&gt;&gt; 2) if #1 is yes, what table(s) will be modified in the SELECT<br>
&gt;&gt;<br>
&gt;&gt; For this purpose we need to invent a new parameter to provide the<br>
&gt;&gt; information above. Suggestions, or even better, patches are welcome.<br>
&gt;&gt;<br>
&gt; <br>
&gt; I was thinking in terms of an explicit function in PgPool-II to invalidate<br>
&gt; cache on chosen tables.<br>
&gt; <br>
&gt; For example if I call a function *SELECT func_that_updates_table_a();*,<br>
&gt; could I then call a function something like *SELECT<br>
&gt; pgpool_cache_invalidate(&#39;table_a&#39;);* and have the cache for that table<br>
&gt; explicitly invalidated? Or would it be possible to put that sort of<br>
&gt; function call inside a function, so the function might do something like<br>
&gt; (pseudocode):<br>
&gt; <br>
&gt; *BEGIN*<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; *INSERT INTO table_a VALUES(&#39;value1&#39;,&#39;value2&#39;);UPDATE table_b SET<br>
&gt; value_a=&#39;something&#39; WHERE value_b=&#39;something&#39;;PERFORM<br>
&gt; pgpool_cache_invalidate(&#39;table_a&#39;);PERFORM<br>
&gt; pgpool_cache_invalidate(&#39;table_b&#39;);*<br>
&gt; <br>
&gt; <br>
&gt; *END;*<br>
&gt; <br>
&gt; Does something like this seem worth investigating?<br>
<br>
I think it is possible to do that if we implement the cache<br>
invalidation feature in PCP command. Invoking PCP command is already<br>
possible by using pgpool_adm extensions.<br>
<br>
<a href="https://www.pgpool.net/docs/latest/en/html/pgpool-adm.html" rel="noreferrer" target="_blank">https://www.pgpool.net/docs/latest/en/html/pgpool-adm.html</a><br>
<br>
pgpool_adm calls C function interface, which is similar to libpq, for<br>
pcp commands.<br>
<br>
So what we need are:<br>
<br>
1) implement new PCP command to invalidate query cache by specifying table, something like:<br>
   pcp_invalidate_query_cache [other standard options such as PCP port number] table_name<br>
<br>
2) implement new pgpool_adm function something like:<br>
   pgpool_adm_pcp_invalidate_query_cache([other pgpool_adm standard parameters], &#39;table_name&#39;);<br>
<br>
What do you think?<br></blockquote><div><br></div><div>This sounds great. I&#39;ll be glad to look into it.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<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></div>