[pgpool-hackers: 161] Re: Suggested patch for check_temp_table setting

Tatsuo Ishii ishii at postgresql.org
Mon Dec 31 09:15:46 JST 2012


Well, the pool_has_system_catalog test is not necessarily connected to
temporary table check. So if we want to avoid pool_has_system_catalog,
we need to invent new flag.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

> Hi everyone.  I've been experimenting with the new "check_temp_table" setting
> that was introduced in version 3.2.  Setting it to "off" definitely reduces the
> number of queries sent to the master, which is great.  However, pgpool-II is
> still preventing system catalog queries from being load-balanced.  From the
> comments, it sounds like the only reason for doing this is to accommodate temporary
> tables:
> 
> pool_query_context.c, lines 422-437:
>   /*
>    * If system catalog is used in the SELECT, we
>    * prefer to send to the primary. Example: SELECT
>    * * FROM pg_class WHERE relname = 't1'; Because
>    * 't1' is a constant, it's hard to recognize as
>    * table name.  Most use case such query is
>    * against system catalog, and the table name can
>    * be a temporary table, it's best to query
>    * against primary system catalog.
>    * Please note that this test must be done *before*
>    * test using pool_has_temp_table.
>    */
>   else if (pool_has_system_catalog(node))
>   {
>   	pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
>   }
> 
> Is there any reason not to use check_temp_table here as well?  The following
> change is working fine for me, and has significantly reduced the amount of
> traffic going to the master, especially during application start-up (when Hibernate
> and the JDBC driver seem to generate a lot of pg_catalog queries).
> 
> diff --git a/pool_query_context.c b/pool_query_context.c
> index 6dbe397..bb84563 100644
> --- a/pool_query_context.c
> +++ b/pool_query_context.c
> @@ -434 +434 @@ void pool_where_to_send(POOL_QUERY_CONTEXT *query_context, char *query, Node *no
> -                                       else if (pool_has_system_catalog(node))
> +                                       else if (pool_config->check_temp_table && pool_has_system_catalog(node))
> 
> -- Matt
> _______________________________________________
> pgpool-hackers mailing list
> pgpool-hackers at pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-hackers


More information about the pgpool-hackers mailing list