[Pgpool-general] [pgpool-general] load balancing for dummies
Tatsuo Ishii
ishii at sraoss.co.jp
Wed Dec 16 09:07:34 UTC 2009
> Hi,
>
> I'm looking at the load balancing and seems to me like is there a way
> to broke the sync of a replication using load balancing if a do
> something stupid like:
>
> """
> create table t1(col1 date);
>
> create table t_int(col1 int);
> insert into t_int select generate_series(1, 10);
>
> create or replace function f1() returns integer as $$
> insert into t1 values(current_date);
> select 1;
> $$ language sql volatile;
>
> select * from t_int where col1 = f1();
> """
>
> the insert executed as a side effect in the function f1() could be
> sent to an slave instead of the master, something we can make to solve
> this?
The short answer is, don't do that.
Long answer:
f1() has two problems:
1) It has a side effect
2) It uses "stable" function (note that CURRENT_DATE() is a stable
function, *not* a volatile function).
If f1() has a side effect and does use IMMUTABLE function only, using
/*REPLICATION*/ comment should solve the problem.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
More information about the Pgpool-general
mailing list