Postgres-XC 1.1 Documentation
Prev | Up |  | Next

# CLEAN CONNECTION

## Name

CLEAN CONNECTION -- Clean up pooler connections in a cluster

## Synopsis

    CLEAN CONNECTION TO { COORDINATOR ( nodename [, ... ] ) | NODE ( nodename [, ... ] ) | ALL {FORCE} }
        [ FOR DATABASE dbname ]
        [ TO USER username ]

## Description

> Note: The following description applies only to Postgres-XC

`CLEAN CONNECTION` cleans pooler connection in a Postgres-XC cluster. This can be done for a give database or role. This command usage is restricted to superusers. It is possible to clean connections to a list of Postgres-XC Coordinators or Datanodes. If TO ALL is specified, connections to all the nodes are cleaned. A `username` or a `dbname` has to be specified to perform `CLEAN CONNECTION`.

## Parameters

`FORCE`

  It can only be specified with the clause `TO ALL`. If specified, all the backends connected to the specified node(s) are closed by sending to them a signal SIGTERM.

`dbname`

  If specified in the optional clause `FOR DATABASE`, pooler connections are cleaned for given database.

`username`

  If specified in the optional clause `TO USER`, pooler connections are cleaned for given role.

`nodename`

  In the case of cleaning connections to a given list of Coordinator, `nodename` has to be specified with the clause `TO COORDINATOR` .

  In the case of cleaning connections to a given list of Datanodes, `nodename` has to be specified with the clause `TO NODE` .

  `num` can contain a list of nodes like in the query:

      CLEAN CONNECTION TO COORDINATOR coord1,coord2 FOR DATABASEname;

  to clean connections to Coordinators coord1 and coord2.

## Notes

`CLEAN CONNECTION` is implemented since Postgres-XC 0.9.3.

## Examples

Cleaning connection to Datanodes dn1 and dn2 for database template1:

    CLEAN CONNECTION TO NODE dn1,dn2 FOR DATABASE template1;

Cleaning connection to Datanode dn3 for role postgres:

    CLEAN CONNECTION TO NODE dn3 TO USER postgres;

Cleaning connection to all nodes on database postgres for role admin and cut connections to backends.

    CLEAN CONNECTION TO ALL FORCE FOR DATABASE postgres TO USER admin;

## Compatibility

`CLEAN CONNECTION` does not conform to the SQL standards, it is a Postgres-XC specific command.

Prev | Home | Next
CHECKPOINT | Up | CLOSE