<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 & 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 <<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>> 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">>> Currently there's no such functionality in Pgpool-II. It's a technical<br>
>> challenge for Pgpool-II because there's no way for Pgpool-II to know<br>
>> what table(s) are modified inside the function.<br>
> <br>
> <br>
> Yes, I figured that was a serious challenge.<br>
> <br>
> <br>
>> To implement such<br>
>> functionality, Pgpool-II needs to know:<br>
>><br>
>> 1) whether the SELECT modifies tables or not.<br>
>><br>
>> 2) if #1 is yes, what table(s) will be modified in the SELECT<br>
>><br>
>> For this purpose we need to invent a new parameter to provide the<br>
>> information above. Suggestions, or even better, patches are welcome.<br>
>><br>
> <br>
> I was thinking in terms of an explicit function in PgPool-II to invalidate<br>
> cache on chosen tables.<br>
> <br>
> For example if I call a function *SELECT func_that_updates_table_a();*,<br>
> could I then call a function something like *SELECT<br>
> pgpool_cache_invalidate('table_a');* and have the cache for that table<br>
> explicitly invalidated? Or would it be possible to put that sort of<br>
> function call inside a function, so the function might do something like<br>
> (pseudocode):<br>
> <br>
> *BEGIN*<br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> *INSERT INTO table_a VALUES('value1','value2');UPDATE table_b SET<br>
> value_a='something' WHERE value_b='something';PERFORM<br>
> pgpool_cache_invalidate('table_a');PERFORM<br>
> pgpool_cache_invalidate('table_b');*<br>
> <br>
> <br>
> *END;*<br>
> <br>
> 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], 'table_name');<br>
<br>
What do you think?<br></blockquote><div><br></div><div>This sounds great. I'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>