EXECUTE DIRECT

Name

EXECUTE DIRECT -- Launch queries directly to dedicated nodes

Synopsis

EXECUTE DIRECT ON
( COORDINATOR nodename [, ... ] | NODE nodename [, ... ] )
    query

Description

Note: The following description applies only to Postgres-XC

EXECUTE DIRECT is a SQL query specially created for Postgres-XC to allow to launch queries directly to dedicated nodes determined by a list of nodes nodelist.

Since Postgres-XC 0.9.3, EXECUTE DIRECT is limited to used on 1 node only. Besides, the query sent to remote nodes designed by a list of nodename is limited to SELECT queries. The usage of transaction queries (BEGIN, COMMIT...), DDL, and DML (INSERT, UPDATE, DELETE ) is forbidden to avoid data inconsistency among nodes in the cluster. EXECUTE DIRECT usage is also limited to superusers.

The user may use COORDINATOR to launch the wanted query on a Postgres-XC Coordinator and NODE to do the same on a Postgres-XC Datanode.

Parameters

COORDINATOR

This option is mandatory when designing a Coordinator node. NODE can be used instead, it is not necessary to specify it.

NODE

This option is mandatory when designing a Datanode node. COORDINATOR can be used instead, it is not necessary to specify it.

nodename

This mandatory clause specifies the node name on where to launch query. When specifying multiple nodes, node names have to be separated by a comma.

query

This mandatory clause specifies the raw query to launch on specified node list nodelist.

Examples

Select some data in a given table tenk1 on remote Datanode named dn1:

EXECUTE DIRECT ON NODE dn1 'SELECT * FROM tenk1 WHERE col_char = ''foo''';

Select local timestamp of a remote Coordinator named coord2:

EXECUTE DIRECT ON COORDINATOR coord2 'select clock_timestamp()';

Select list of tables of a remote Datanode named dn50:

EXECUTE DIRECT ON NODE dn50 'select tablename from pg_tables';

Compatibility

EXECUTE DIRECT does not conform to the SQL standards, it is a Postgres-XC specific command.