[pgpool-general: 1501] Re: Load balancing changes between 2.x and 3.x

Tatsuo Ishii ishii at postgresql.org
Fri Mar 15 08:25:42 JST 2013


>>>> Yes. Main difference is, 3.x does more load balance when operated in
>>>> streaming replication mode. For example, even if you in an explicit
>>>> transaction block, pgpool allows to load balance SELECTs.
>>>
>>> So using:
>>>
>>> BEGIN;
>>> SELECT
>>> COMMIT;
>>>
>>> In 2.x will not be load balanced but in 3 it will?
>>
>> Yes, if you set:
>>
>> master_slave_mode = on
>>
>> However, please note, if you mix write queries, no load balance.
>>
>> BEGIN;
>> SELECT <-- load balance
>> SELECT <-- again load balance
>> UPDATE
>> SELECT <-- no load balance any more
>> COMMIT;
> 
> Considering this, what is the best way to handle the use of functions
> that do writes? Using 2.x if we do this:
> 
> select update_function();
> 
> It will get load balanced. However if we do this:
> 
> BEGIN;
> select update_function();
> COMMIT;
> 
> It will not get load balanced. How do we achieve the same behavior in
> 3.x?

I'm not sure what you want to do...

If "select update_function();" is sent to standby node because of load
balance, PostgreSQL will not accept the query because it tries to
update standby database, no?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp
 


More information about the pgpool-general mailing list