<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:10pt"><div><span><br></span></div><div>&nbsp;</div><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> Thursday, February 16, 2012 7:16 AM<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;&gt; I basically wanted to see the effects of relcache_expire. Please let me know how to test it?<br>&gt; <br>&gt; 1) set relcache_expire to 60(for example)<br>&gt; 2) start pgpool<br>&gt; 3) SELECT * FROM t1(or whatever table)<br>&gt; 4) you see accesses to pg_class<br>&gt; 5) within 60 seconds, issue same query as #3<br>&gt; 6) this you should not see access to the system catalog<br>&gt; <br>&gt; 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>User's query itself does
 not use relcache inside pgpool at<br>all. Relcache are only used for determing how to control user's query:<br>for example whether to send to primary or master, whether to issune<br>lock command or not etc. User's query always accesses real tables.<br><br>-&gt;okay. How the obsolete contents of relcache affects the user then? I thought if the table is altered by the admin and user executes the same query, he will get the old table structure because relcache is not updated. and this was the reason relcache_expire was added. How can I test this ALTER TABLE scenario?<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;&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: Wednesday, February 15, 2012 1:22 PM<br>&gt;&gt; Subject: Re: [pgpool-general: 221] Re: More information on relcache_expire<br>&gt;&gt;&nbsp; <br>&gt;&gt; Relcache only takes care of SELECTs issued by pgpool internaly. So<br>&gt;&gt; your SELECT will not benefit from it.<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; Thanks Tatsuo!<br>&gt;&gt;&gt; <br>&gt;&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;&gt; I connect to database through pgpool port 9999. At the psql prompt, I created a table with 3 columns:<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; CREATE TABLE phonebook(phone VARCHAR(32), name VARCHAR(32), address VARCHAR(64));<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; I inserted proper values and then executed the select query which returns proper values.<br>&gt;&gt;&gt; SELECT * FROM phonebook ORDER BY name;<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; Now, I alter the table and rename the column 'name' with 'firstname'<br>&gt;&gt;&gt; ALTER TABLE phonebook RENAME COLUMN name TO firstname;<br>&gt;&gt;&gt; <br>&gt;&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;&gt; <br>&gt;&gt;&gt; <br>&gt;&gt;&gt; <br>&gt;&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:52 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; right, that makes sense. Thanks!<br>&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt; BTW, how do we know that the query result is returned from the cache or not?<br>&gt;&gt;&gt; <br>&gt;&gt;&gt; Please look into PostgreSQL log. If you see access to pg_class or so<br>&gt;&gt;&gt; before user's query, that is the accessed from pgpool, thus cache
 is<br>&gt;&gt;&gt; not used.<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: Tatsuo Ishii &lt;<a ymailto="mailto:ishii@postgresql.org" href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>&gt;&gt;&gt;&gt; To: <a ymailto="mailto:sandeeptt@yahoo.com" href="mailto:sandeeptt@yahoo.com">sandeeptt@yahoo.com</a> <br>&gt;&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;&gt; Sent: Tuesday, February 14, 2012 2:11 PM<br>&gt;&gt;&gt;&gt; Subject: Re: [pgpool-general: 221] Re: More
 information on relcache_expire<br>&gt;&gt;&gt;&gt;&nbsp; <br>&gt;&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;&gt; <br>&gt;&gt;&gt;&gt; Yes.<br>&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt; On what basis one would define the value of relcache_expire in pgpool.conf?<br>&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt; I don't think changing table structure so frequently is a real life<br>&gt;&gt;&gt;&gt; usecase. Rather I think it happens during application development:<br>&gt;&gt;&gt;&gt; table structures are not stable.<br>&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt; If your customer really wants to change table structure every 5<br>&gt;&gt;&gt;&gt; minutes, probably there's something wrong with user's work flow<br>&gt;&gt;&gt;&gt; anyway.<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; ________________________________<br>&gt;&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;&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;&gt; Sent: Monday, February 13, 2012 1:58 PM<br>&gt;&gt;&gt;&gt;&gt; Subject: [pgpool-general: 220] More information on
 relcache_expire<br>&gt;&gt;&gt;&gt;&gt;&nbsp; <br>&gt;&gt;&gt;&gt;&gt; <br>&gt;&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;&gt; &nbsp;I would like to know how to make use of this directive? A test case will help.<br>&gt;&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt;&gt; Thanks.<br>&gt;&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt;&gt; <br>&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>&gt;&gt;&gt;&gt;&gt; pgpool-general mailing list<br>&gt;&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;&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>