Move Sessions Between Clusters
In situations where worker clusters can be dynamically started and stopped, it may be desirable for DBAs to be able to move sessions from one cluster to another. This flexibility can enable DBAs to better manage the loads on clusters. Exasol allows sessions to be moved from the main cluster to a worker cluster using the SQL statement CONTROL MOVE SESSION.
Move Sessions to a Worker Cluster
You can specify a single session, a comma-separated list of sessions, or all inactive sessions to be moved to a worker cluster. The sessions must have been initiated on the main cluster. If a session was initiated on the main cluster and then moved to a worker cluster, it can however be moved again to another worker cluster.
A timeout value in seconds can be specified. If a session is not moved within the timeout, an exception is thrown for this session. Optionally, all currently running statements can be forcibly killed on sessions that cannot be moved within the timeout.
Clusters can be specified by cluster name or cluster UID.
- To determine the current cluster name for the current session, use
SELECT CURRENT_CLUSTER;
- To determine the current cluster name for all other sessions, use
SELECT CLUSTER_NAME, SESSION_ID FROM EXA_DBA_SESSIONS;
- To determine the current cluster UID for a session, use
SELECT CURRENT_CLUSTER_UID;
- To determine the cluster names, use
SELECT CLUSTER_NAME FROM EXA_CLUSTERS;
Examples
To move two sessions from the main cluster to a worker cluster:
For more details and examples, see CONTROL MOVE SESSION.