[pgpool-hackers: 2800] [New feature] Enable specifying SQL patterns lists that should not be load-balanced.
Bo Peng
pengbo at sraoss.co.jp
Mon May 14 12:01:09 JST 2018
Hi All
Here is a patch for new feature "Enable specifying
SQL patterns lists that should not be load-balanced".
Even though currently we can do this by adding the
/*NO LOAD BALANCE*/ comment to queries, this requires
modifying application codes and this is not always
possible.
This feature enables specifying SQL patterns lists
that should not be load-balanced.
-------------
New parameter
-------------
black_query_pattern_list = ''
You can specify a semicolon separated list of SQL patterns
that should be sent to primary node only.
SQL that matched patterns specified in this list are not load balanced.
Only Maste Slave mode is supported.
You can use regular expression to match SQL patterns,
to which ^ and $ are automatically added.
When using characters such as "'", ";" or "*" in SQL patterns,
you need to escape them using "\".
Example:
If the following SQL should be sent to the primary node only,
SELECT * FROM table_name1;
SELECT * FROM table_name2 WHERE col LIKE '%a%';
SQL including table_nama3
You can set the black_query_pattern_list like below:
black_query_pattern_list = 'SELECT \* FROM table_name1\;;SELECT col1, col2 FROM table_name2 WHERE col1 LIKE \\'%a%\\'\;;.*table_name3.*'
--
Bo Peng <pengbo at sraoss.co.jp>
SRA OSS, Inc. Japan
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: black_query.diff
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20180514/31b53330/attachment-0001.ksh>
More information about the pgpool-hackers
mailing list