<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:10pt"><br><br><div style="font-family: times new roman, new york, times, serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Tatsuo Ishii &lt;ishii@postgresql.org&gt;<br> <b><span style="font-weight: bold;">To:</span></b> sandeeptt@yahoo.com <br><b><span style="font-weight: bold;">Cc:</span></b> pgpool-general@pgpool.net <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, February 15, 2012 3:53 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [pgpool-general: 221] Re: More information on relcache_expire<br> </font> </div> <br>
&gt; So, in this case, pgpool does not execute SELECT query internally?<br><br>Right.<br><br>&gt;&nbsp; I see some queries to pg_class in the server log.<br><br>Probably you issue the next query in different session?&nbsp; It is<br>possible that you do not see the relcache effect because 1) relcache<br>is per session(pgpool child proccess), not whole pgpool instance 2)<br>there is "session local" type relcache. Typically used for checking if<br>the table is a temporary one or not. The type of relcache's life is<br>limited within the same saession.<br><br>&gt; I basically wanted to see the effects of relcache_expire. Please let me know how to test it?<br><br>1) set relcache_expire to 60(for example)<br>2) start pgpool<br>3) SELECT * FROM t1(or whatever table)<br>4) you see accesses to pg_class<br>5) within 60 seconds, issue same query as #3<br>6) this you should not see access to the system catalog<br><br>This works as expected. Thanks. The only thing I
 didn't understand is that if I I alter the structure of the table before I execute #5, and #6 works as expected (it does not access system catalog), then how come the the query at #5 returns the updated table structure? Because within 60 secs, it would not access the system catalogue and access the relation cache, right? This is seen at #6. This would mean tat relation cache had an updated table structure. Question is how? I do all the above steps in a same client connection.<br><br>--<br>Tatsuo Ishii<br>SRA OSS, Inc. Japan<br>English: http://www.sraoss.co.jp/index_en.php<br>Japanese: http://www.sraoss.co.jp<br><br>&gt; ________________________________<br>&gt;&nbsp; From: Tatsuo Ishii &lt;<a ymailto="mailto:ishii@postgresql.org" href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>&gt; To: <a ymailto="mailto:sandeeptt@yahoo.com" href="mailto:sandeeptt@yahoo.com">sandeeptt@yahoo.com</a> <br>&gt; Cc: <a
 ymailto="mailto:pgpool-general@pgpool.net" href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a> <br>&gt; Sent: Wednesday, February 15, 2012 1:22 PM<br>&gt; Subject: Re: [pgpool-general: 221] Re: More information on relcache_expire<br>&gt;&nbsp; <br>&gt; Relcache only takes care of SELECTs issued by pgpool internaly. So<br>&gt; your SELECT will not benefit from it.<br>&gt; --<br>&gt; Tatsuo Ishii<br>&gt; SRA OSS, Inc. Japan<br>&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; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>&gt; <br>&gt;&gt; Thanks Tatsuo!<br>&gt;&gt; <br>&gt;&gt; I have setup a Master and Slave configuration and set relcache_expire as 600 in pgpool.conf. Now I do manual testing within 600 seconds. <br>&gt;&gt; I connect to database through pgpool port 9999. At the psql prompt, I created a table with 3
 columns:<br>&gt;&gt; <br>&gt;&gt; CREATE TABLE phonebook(phone VARCHAR(32), name VARCHAR(32), address VARCHAR(64));<br>&gt;&gt; <br>&gt;&gt; I inserted proper values and then executed the select query which returns proper values.<br>&gt;&gt; SELECT * FROM phonebook ORDER BY name;<br>&gt;&gt; <br>&gt;&gt; Now, I alter the table and rename the column 'name' with 'firstname'<br>&gt;&gt; ALTER TABLE phonebook RENAME COLUMN name TO firstname;<br>&gt;&gt; <br>&gt;&gt; Now, the same select query returns me the ERROR "column "name" does not exist".&nbsp; I thought it should return fine because relation cache would not have updated table structure, right? Or am I missing something?<br>&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; ________________________________<br>&gt;&gt;&nbsp; From: Tatsuo Ishii &lt;<a ymailto="mailto:ishii@postgresql.org" href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>&gt;&gt; To: <a
 ymailto="mailto:sandeeptt@yahoo.com" href="mailto:sandeeptt@yahoo.com">sandeeptt@yahoo.com</a> <br>&gt;&gt; Cc: <a ymailto="mailto:pgpool-general@pgpool.net" href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a> <br>&gt;&gt; Sent: Tuesday, February 14, 2012 2:52 PM<br>&gt;&gt; Subject: Re: [pgpool-general: 221] Re: More information on relcache_expire<br>&gt;&gt;&nbsp; <br>&gt;&gt;&gt; right, that makes sense. Thanks!<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; BTW, how do we know that the query result is returned from the cache or not?<br>&gt;&gt; <br>&gt;&gt; Please look into PostgreSQL log. If you see access to pg_class or so<br>&gt;&gt; before user's query, that is the accessed from pgpool, thus cache is<br>&gt;&gt; not used.<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; ________________________________<br>&gt;&gt;&gt;&nbsp; From: Tatsuo Ishii &lt;<a ymailto="mailto:ishii@postgresql.org" href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>&gt;&gt;&gt; To: <a ymailto="mailto:sandeeptt@yahoo.com" href="mailto:sandeeptt@yahoo.com">sandeeptt@yahoo.com</a> <br>&gt;&gt;&gt; Cc: <a ymailto="mailto:pgpool-general@pgpool.net" href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a> <br>&gt;&gt;&gt; Sent: Tuesday, February 14, 2012 2:11 PM<br>&gt;&gt;&gt; Subject: Re: [pgpool-general: 221] Re: More information on relcache_expire<br>&gt;&gt;&gt;&nbsp; <br>&gt;&gt;&gt;&gt; I mean, let's say I define the value of relcache_expire as "600" seconds. and the TABLE in cache is ALTERED before that. That means my query will produce the wrong result because the relation cache is not yet updated/expired,
 right?<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; Yes.<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; On what basis one would define the value of relcache_expire in pgpool.conf?<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; I don't think changing table structure so frequently is a real life<br>&gt;&gt;&gt; usecase. Rather I think it happens during application development:<br>&gt;&gt;&gt; table structures are not stable.<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; If your customer really wants to change table structure every 5<br>&gt;&gt;&gt; minutes, probably there's something wrong with user's work flow<br>&gt;&gt;&gt; anyway.<br>&gt;&gt;&gt; --<br>&gt;&gt;&gt; Tatsuo Ishii<br>&gt;&gt;&gt; SRA OSS, Inc. Japan<br>&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; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt;
 ________________________________<br>&gt;&gt;&gt;&gt;&nbsp; From: Sandeep Thakkar &lt;<a ymailto="mailto:sandeeptt@yahoo.com" href="mailto:sandeeptt@yahoo.com">sandeeptt@yahoo.com</a>&gt;<br>&gt;&gt;&gt;&gt; To: "<a ymailto="mailto:pgpool-general@pgpool.net" href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a>" &lt;<a ymailto="mailto:pgpool-general@pgpool.net" href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a>&gt; <br>&gt;&gt;&gt;&gt; Sent: Monday, February 13, 2012 1:58 PM<br>&gt;&gt;&gt;&gt; Subject: [pgpool-general: 220] More information on relcache_expire<br>&gt;&gt;&gt;&gt;&nbsp; <br>&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt; - Add relcache_expire directive to control the expiration of the internal system catalog cache. ALTER TABLE might make these cache values obsoleted and the new directive will make the risk lower(Tatsuo)<br>&gt;&gt;&gt;&gt; &nbsp;I would like to know how to make use of this directive? A test case
 will help.<br>&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt; Thanks.<br>&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt; _______________________________________________<br>&gt;&gt;&gt;&gt; pgpool-general mailing list<br>&gt;&gt;&gt;&gt; <a ymailto="mailto:pgpool-general@pgpool.net" href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a><br>&gt;&gt;&gt;&gt; <a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br><br><br> </div> </div>  </div></body></html>