diff --git a/pkg/cluster/connection_pooler.go b/pkg/cluster/connection_pooler.go index f579b446e4c07c6584b4d54dcb98adbb567725f3..97cbc16c1049d250d462c2ca3efb04ff6ddf0501 100644 --- a/pkg/cluster/connection_pooler.go +++ b/pkg/cluster/connection_pooler.go @@ -162,7 +162,11 @@ func (c *Cluster) getConnectionPoolerEnvVars() []v1.EnvVar { maxDBConn := *effectiveMaxDBConn / *numberOfInstances - defaultSize := maxDBConn / 2 + // Following pooler parameters are per pool, which means they have to be + // calculated from the global max db connections adjusted by the number of + // pairs (database, user). + numberOfPools := int32(len(spec.Users) * len(spec.Databases)) + defaultSize := (maxDBConn / numberOfPools) / 2 minSize := defaultSize / 2 reserveSize := minSize