Re: Why standby.max_connections must be higher than primary.max_connections? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Why standby.max_connections must be higher than primary.max_connections?
Date
Msg-id CA+Tgmoan+Ook6d2BS+nrK1cYeY8=t3qnejD-CG6phV8nro06VQ@mail.gmail.com
Whole thread Raw
In response to Why standby.max_connections must be higher than primary.max_connections?  (山田聡 <satoshi.yamada.pg@gmail.com>)
Responses Re: Why standby.max_connections must be higher than primary.max_connections?
Re: Why standby.max_connections must be higher than primary.max_connections?
List pgsql-hackers
On Tue, Dec 10, 2013 at 3:34 AM, 山田聡 <satoshi.yamada.pg@gmail.com> wrote:
> Hello hackers.
>
> I am struggling to understand why standby.max_connections must be higher
> than
> primary.max_connections.Do someone know the reason why?

Because the KnownAssignedXIDs and lock tables on the standby need to
be large enough to contain the largest snapshot and greatest number of
AccessExclusiveLocks that could exist on the master at any given time.

> I think this restriction obstructs making a flexible load balancing.
> I'd like to make standby database to use load balancing.Of course
> a role of a standby server is different from one of a master server.
> So I think it it natural that I want to set standby.max_connections less
> than
> primary.max_connections.

Your load balancer should probably have a configuration setting that
controls how many connections it will try to make to the database, and
you can set that to a lower value than max_connections.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: tracking commit timestamps
Next
From: Josh Berkus
Date:
Subject: Re: plpgsql_check_function - rebase for 9.3