diff --git a/flow/connectors/postgres/client.go b/flow/connectors/postgres/client.go index ba7e53a8dc..777198801d 100644 --- a/flow/connectors/postgres/client.go +++ b/flow/connectors/postgres/client.go @@ -217,7 +217,6 @@ func (c *PostgresConnector) GetSlotInfo(slotName string) ([]*protos.SlotInfo, er FROM pg_control_checkpoint(), pg_replication_slots`+specificSlotClause+`;`) - if err != nil { return nil, err } diff --git a/flow/connectors/postgres/postgres.go b/flow/connectors/postgres/postgres.go index 469775e49e..0cd374d082 100644 --- a/flow/connectors/postgres/postgres.go +++ b/flow/connectors/postgres/postgres.go @@ -47,6 +47,9 @@ func NewPostgresConnector(ctx context.Context, pgConfig *protos.PostgresConfig) runtimeParams["idle_in_transaction_session_timeout"] = "0" runtimeParams["statement_timeout"] = "0" + // set pool size to 3 to avoid connection pool exhaustion + connConfig.MaxConns = 3 + pool, err := pgxpool.NewWithConfig(ctx, connConfig) if err != nil { return nil, fmt.Errorf("failed to create connection pool: %w", err)