I have add to black_function_list = &#39;nextval,setval,to_tsquery,to_tsvector&#39;<div><br></div><div>but there is an error again. (ERROR:  kind mismatch among backends)</div><div><br></div><div><br></div><div><br></div><div>
<br><div class="gmail_quote">2012/6/13 Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Don&#39;t you use to_tsquery()?<br>
<br>
But you have:<br>
<div class="im">&gt;&gt; &gt;&gt; &gt; white_function_list = &#39;&#39;<br>
&gt;&gt; &gt;&gt; &gt; black_function_list = &#39;nextval,setval&#39;<br>
<br>
</div>So the function should not prevent load balance the EXPLAIN.<br>
I will look into this...<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; No, the explains don&#39;t use function.<br>
&gt;<br>
&gt; This is the explain:<br>
&gt;<br>
&gt;<br>
&gt; EXPLAIN SELECT a.adid AS a__adid, a.md5 AS a__md5, a.site AS a__site,<br>
&gt; a.published AS a__published, a.imported AS a__imported, a.year AS a__year,<br>
&gt; a.mileage AS a__mileage, a.price AS a__price, a.make AS a__make, a.model AS<br>
&gt; a__model, a.location AS a__location, a.title AS a__title, a.description AS<br>
&gt; a__description, a.specials AS a__specials, a.source_url AS a__source_url,<br>
&gt; a.image_url AS a__image_url, a.num_images AS a__num_images, a.version AS<br>
&gt; a__version, a.fuel AS a__fuel, a.colour AS a__colour, a.transmission AS<br>
&gt; a__transmission, a.body AS a__body, a.category AS a__category<br>
&gt; FROM insertion a<br>
&gt; WHERE (a.make = &#39;fiat&#39; AND a.i_fulltext @@ to_tsquery(&#39;italian&#39;, &#39;doblo&#39;)<br>
&gt; AND a.adid NOT IN (&#39;20120423.041004.362964&#39;) AND a.i_fulltext @@<br>
&gt; to_tsquery(&#39;italian&#39;, &#39;(metano)&#39;) AND a.i_location @@ &#39;puglia&#39;::tsquery AND<br>
&gt; a.published &gt;= &#39;2012/06/11&#39;) ORDER BY a.published DESC NULLS LAST LIMIT<br>
&gt; 1000;<br>
&gt;<br>
&gt;<br>
&gt; Result ---- Server A -------<br>
&gt;<br>
&gt;<br>
&gt; Limit  (cost=<a href="tel:713.46..713.46" value="+17134671346">713.46..713.46</a> rows=1 width=952)<br>
&gt;    -&gt;  Sort  (cost=<a href="tel:713.46..713.46" value="+17134671346">713.46..713.46</a> rows=1 width=952)<br>
&gt;          Sort Key: published<br>
&gt;          -&gt;  Bitmap Heap Scan on insertion a  (cost=<a href="tel:669.45..713.45" value="+16694571345">669.45..713.45</a> rows=1<br>
&gt; width=952)<br>
&gt;                Recheck Cond: ((i_fulltext @@ &#39;&#39;&#39;dobl&#39;&#39;&#39;::tsquery) AND<br>
&gt; (i_fulltext @@ &#39;&#39;&#39;met&#39;&#39;&#39;::tsquery) AND (i_location @@<br>
&gt; &#39;&#39;&#39;puglia&#39;&#39;&#39;::tsquery))<br>
&gt;                Filter: (((adid)::text &lt;&gt; &#39;20120423.041004.362964&#39;::text)<br>
&gt; AND (published &gt;= &#39;2012-06-11 00:00:00&#39;::timestamp without time zone) AND<br>
&gt; ((make)::text = &#39;fiat&#39;::text))<br>
&gt;                -&gt;  BitmapAnd  (cost=<a href="tel:669.45..669.45" value="+16694566945">669.45..669.45</a> rows=11 width=0)<br>
&gt;                      -&gt;  Bitmap Index Scan on insertion_i_fulltext_idx<br>
&gt;  (cost=0.00..37.84 rows=184 width=0)<br>
&gt;                            Index Cond: ((i_fulltext @@ &#39;&#39;&#39;dobl&#39;&#39;&#39;::tsquery)<br>
&gt; AND (i_fulltext @@ &#39;&#39;&#39;met&#39;&#39;&#39;::tsquery))<br>
&gt;                      -&gt;  Bitmap Index Scan on insertion_i_location_idx<br>
&gt;  (cost=0.00..631.36 rows=59648 width=0)<br>
&gt;                            Index Cond: (i_location @@ &#39;&#39;&#39;puglia&#39;&#39;&#39;::tsquery)<br>
&gt; (11 rows)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Result ---- Server B -------<br>
&gt;<br>
&gt;<br>
&gt;  Limit  (cost=678.00..678.00 rows=1 width=957)<br>
&gt;    -&gt;  Sort  (cost=678.00..678.00 rows=1 width=957)<br>
&gt;          Sort Key: published<br>
&gt;          -&gt;  Bitmap Heap Scan on insertion a  (cost=37.63..677.99 rows=1<br>
&gt; width=957)<br>
&gt;                Recheck Cond: ((i_fulltext @@ &#39;&#39;&#39;dobl&#39;&#39;&#39;::tsquery) AND<br>
&gt; (i_fulltext @@ &#39;&#39;&#39;met&#39;&#39;&#39;::tsquery))<br>
&gt;                Filter: (((adid)::text &lt;&gt; &#39;20120423.041004.362964&#39;::text)<br>
&gt; AND (i_location @@ &#39;&#39;&#39;puglia&#39;&#39;&#39;::tsquery) AND (published &gt;= &#39;2012-06-11<br>
&gt; 00:00:00&#39;::timestamp without time zone) AND ((make)::text = &#39;fiat&#39;::text))<br>
&gt;                -&gt;  Bitmap Index Scan on insertion_i_fulltext_idx<br>
&gt;  (cost=0.00..37.63 rows=163 width=0)<br>
&gt;                      Index Cond: ((i_fulltext @@ &#39;&#39;&#39;dobl&#39;&#39;&#39;::tsquery) AND<br>
&gt; (i_fulltext @@ &#39;&#39;&#39;met&#39;&#39;&#39;::tsquery))<br>
&gt; (8 righe)<br>
&gt;<br>
&gt;<br>
&gt;  I will resolve this problem (different result) soon. It&#39;s possible execute<br>
&gt; explain  only server A or only server B ?<br>
&gt;<br>
&gt; Regards<br>
&gt;<br>
&gt;<br>
&gt; 2012/6/13 Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;<br>
&gt;&gt; Do those failed &quot;complex&quot; EXPLAINs contain funcation calls, especially<br>
&gt;&gt; nextval or setval?  If so, I think it&#39;s the case where pgpool has a<br>
&gt;&gt; logical error I have just found. Pgpool first checks if the query is<br>
&gt;&gt; EXPLAIN (and not EXPLAIN ANALYZE). If so, it&#39;s ok to load<br>
&gt;&gt; balance. Problem is the next step. Pgpool looks into the EXPLAIN and<br>
&gt;&gt; if it finds a function call, it sends to all PostgreSQL nodes because<br>
&gt;&gt; the function might modify database. Of course this is nonsense, since<br>
&gt;&gt; plain EXPLAIN does nothing to database...<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; No, a few Explain cause errors.<br>
&gt;&gt; &gt; The trivial explain is ok. The complex explain causes this error :(<br>
&gt;&gt; &gt; In fact, as I have seen,  even if the table has the same row/index, the<br>
&gt;&gt; &gt; explain gives differen results. I will resolve this soon.<br>
&gt;&gt; &gt; I want that the explain gets only done on the master node. Only one node.<br>
&gt;&gt; &gt; Does  the configuration “replicate_explain = off” exist ???<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks for your answer.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Nicolas<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2012/6/13 Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; Even trivial explain like &quot;EXPLAIN SELECT 1&quot; causes errors?<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; Hi,<br>
&gt;&gt; &gt;&gt; &gt; I would like to know if I can exclude the command EXPLAIN from the<br>
&gt;&gt; &gt;&gt; pgpool.<br>
&gt;&gt; &gt;&gt; &gt; It generates a lot of errors:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; 2012-06-13 09:35:11 ERROR: pid 15204: read_kind_from_backend: 1 th<br>
&gt;&gt; kind C<br>
&gt;&gt; &gt;&gt; &gt; does not match with master or majority connection kind D<br>
&gt;&gt; &gt;&gt; &gt; 2012-06-13 09:35:11 ERROR: pid 15204: kind mismatch among backends.<br>
&gt;&gt; &gt;&gt; &gt; Possible last query was: &quot;EXPLAIN SELECT ...... &quot; kind details are:<br>
&gt;&gt; 0[D]<br>
&gt;&gt; &gt;&gt; &gt; 1[C]<br>
&gt;&gt; &gt;&gt; &gt; 2012-06-13 09:35:11 LOG:   pid 15204: do_child: exits with status 1<br>
&gt;&gt; due<br>
&gt;&gt; &gt;&gt; to<br>
&gt;&gt; &gt;&gt; &gt; error<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; pool-II-3.1.3<br>
&gt;&gt; &gt;&gt; &gt; PostgreSQL 9.1.2<br>
&gt;&gt; &gt;&gt; &gt; both Server same Hardware.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Pgpool configuration:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; listen_addresses = &#39;*&#39;<br>
&gt;&gt; &gt;&gt; &gt; port = 5432<br>
&gt;&gt; &gt;&gt; &gt; socket_dir = &#39;/var/run/postgresql&#39;<br>
&gt;&gt; &gt;&gt; &gt; pcp_port = 9898<br>
&gt;&gt; &gt;&gt; &gt; pcp_socket_dir = &#39;/tmp&#39;<br>
&gt;&gt; &gt;&gt; &gt; backend_hostname0 = &#39;localhost&#39;<br>
&gt;&gt; &gt;&gt; &gt; backend_port0 = 5434<br>
&gt;&gt; &gt;&gt; &gt; backend_weight0 = 1<br>
&gt;&gt; &gt;&gt; &gt; backend_data_directory0 = &#39;/var/lib/postgresql/9.1/main&#39;<br>
&gt;&gt; &gt;&gt; &gt; backend_flag0 = &#39;ALLOW_TO_FAILOVER&#39;<br>
&gt;&gt; &gt;&gt; &gt; backend_hostname1 = &#39;172.16.0.1&#39;<br>
&gt;&gt; &gt;&gt; &gt; backend_port1 = 5434 #doveva essere a 5434<br>
&gt;&gt; &gt;&gt; &gt; backend_weight1 = 1<br>
&gt;&gt; &gt;&gt; &gt; backend_data_directory1 = &#39;/var/lib/postgresql/9.1/main&#39;<br>
&gt;&gt; &gt;&gt; &gt; backend_flag1 = &#39;ALLOW_TO_FAILOVER&#39;<br>
&gt;&gt; &gt;&gt; &gt; enable_pool_hba = off<br>
&gt;&gt; &gt;&gt; &gt; authentication_timeout = 60<br>
&gt;&gt; &gt;&gt; &gt; # - SSL Connections -<br>
&gt;&gt; &gt;&gt; &gt; num_init_children = 32<br>
&gt;&gt; &gt;&gt; &gt; max_pool = 10<br>
&gt;&gt; &gt;&gt; &gt; child_life_time = 300<br>
&gt;&gt; &gt;&gt; &gt; child_max_connections = 0<br>
&gt;&gt; &gt;&gt; &gt; connection_life_time = 0<br>
&gt;&gt; &gt;&gt; &gt; client_idle_limit = 0<br>
&gt;&gt; &gt;&gt; &gt; log_destination = &#39;stderr&#39;<br>
&gt;&gt; &gt;&gt; &gt; print_timestamp = on<br>
&gt;&gt; &gt;&gt; &gt; log_connections = off<br>
&gt;&gt; &gt;&gt; &gt; log_hostname = on<br>
&gt;&gt; &gt;&gt; &gt; log_statement = off<br>
&gt;&gt; &gt;&gt; &gt; log_per_node_statement = off<br>
&gt;&gt; &gt;&gt; &gt; log_standby_delay = &#39;none&#39;<br>
&gt;&gt; &gt;&gt; &gt; syslog_facility = &#39;LOCAL0&#39;<br>
&gt;&gt; &gt;&gt; &gt; syslog_ident = &#39;pgpool&#39;<br>
&gt;&gt; &gt;&gt; &gt; debug_level = 0<br>
&gt;&gt; &gt;&gt; &gt; pid_file_name = &#39;/var/run/pgpool/pgpool.pid&#39;<br>
&gt;&gt; &gt;&gt; &gt; logdir = &#39;/tmp&#39;<br>
&gt;&gt; &gt;&gt; &gt; connection_cache = on<br>
&gt;&gt; &gt;&gt; &gt; reset_query_list = &#39;ABORT; DISCARD ALL&#39;<br>
&gt;&gt; &gt;&gt; &gt; replication_mode = on<br>
&gt;&gt; &gt;&gt; &gt; replicate_select = off<br>
&gt;&gt; &gt;&gt; &gt; insert_lock = on<br>
&gt;&gt; &gt;&gt; &gt; lobj_lock_table = &#39;&#39;<br>
&gt;&gt; &gt;&gt; &gt; replication_stop_on_mismatch = off<br>
&gt;&gt; &gt;&gt; &gt; failover_if_affected_tuples_mismatch = off<br>
&gt;&gt; &gt;&gt; &gt; load_balance_mode =  off<br>
&gt;&gt; &gt;&gt; &gt; ignore_leading_white_space = on<br>
&gt;&gt; &gt;&gt; &gt; white_function_list = &#39;&#39;<br>
&gt;&gt; &gt;&gt; &gt; black_function_list = &#39;nextval,setval&#39;<br>
&gt;&gt; &gt;&gt; &gt; master_slave_mode = off<br>
&gt;&gt; &gt;&gt; &gt; sr_check_period = 0<br>
&gt;&gt; &gt;&gt; &gt; sr_check_user = &#39;nobody&#39;<br>
&gt;&gt; &gt;&gt; &gt; sr_check_password = &#39;&#39;<br>
&gt;&gt; &gt;&gt; &gt; delay_threshold = 0<br>
&gt;&gt; &gt;&gt; &gt; follow_master_command = &#39;&#39;<br>
&gt;&gt; &gt;&gt; &gt; parallel_mode = off<br>
&gt;&gt; &gt;&gt; &gt; enable_query_cache = off<br>
&gt;&gt; &gt;&gt; &gt; pgpool2_hostname = &#39;localhost&#39;<br>
&gt;&gt; &gt;&gt; &gt; system_db_hostname  = &#39;localhost&#39;<br>
&gt;&gt; &gt;&gt; &gt; system_db_port = 5434<br>
&gt;&gt; &gt;&gt; &gt; system_db_dbname = &#39;pgpool&#39;<br>
&gt;&gt; &gt;&gt; &gt; system_db_schema = &#39;pgpool_catalog&#39;<br>
&gt;&gt; &gt;&gt; &gt; system_db_user = &#39;pgpool&#39;<br>
&gt;&gt; &gt;&gt; &gt; system_db_password = &#39;&#39;<br>
&gt;&gt; &gt;&gt; &gt; health_check_period = 0<br>
&gt;&gt; &gt;&gt; &gt; health_check_timeout = 20<br>
&gt;&gt; &gt;&gt; &gt; health_check_user = &#39;nobody&#39;<br>
&gt;&gt; &gt;&gt; &gt; health_check_password = &#39;&#39;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; ------------------------------------<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; The answers about these questions are welcome.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Best Regards<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Nicolas<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt;<br>
</div></div></blockquote></div><br></div>