summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/execute_direct.sgml
blob: 843c3a5ae071df80bfb4d86179316a599506d5cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

<refentry id="SQL-EXECUTEDIRECT">
 <indexterm zone="sql-executedirect">
  <primary>EXECUTE DIRECT</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>EXECUTE DIRECT</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>EXECUTE DIRECT</refname>
  <refpurpose>Launch queries directly to dedicated nodes</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
<synopsis>
EXECUTE DIRECT ON ( <replaceable class="parameter">nodename</replaceable> [, ... ] )
    <replaceable class="parameter">query</replaceable>
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>EXECUTE DIRECT</command> is a SQL command specially created for
   <productname>Postgres-XL</productname> to allow launching queries directly
   on one of the nodes determined by a list of nodes <replaceable
   class="parameter"> nodelist</replaceable>. 
  </para>

  <para>
   EXECUTE DIRECT is currenlty limited to be used on 1 node at a time
   only. 
   The usage of transaction queries
   (<literal>BEGIN</literal>, <literal>COMMIT</literal>...), DDL, and DML
   (<literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>DELETE
   </literal>) is forbidden to avoid data inconsistency among nodes
   in the cluster. EXECUTE DIRECT usage is also limited to superusers.
  </para>

  <para>
    Either a Coordinator or Datanode can be selected by its node name.
  </para>

  <para>
   <command>EXECUTE DIRECT</> allows the usage of the following utility commands
   on remote nodes: <command>CREATE TABLESPACE</>, <command>DROP TABLESPACE</>.
  </para>

 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
   <varlistentry>
    <term><replaceable class="parameter">nodename</replaceable></term>
    <listitem>
     <para>
      This mandatory clause specifies the node name on where to launch
      <replaceable class="parameter">query</replaceable>. When specifying
      multiple nodes, node names have to be separated by a comma.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">query</replaceable></term>
    <listitem>
     <para>
      This mandatory clause specifies the raw query to launch
      on specified node list <replaceable class="parameter">nodelist</replaceable>.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   Select some data in a given table tenk1 on remote Datanode named dn1:
<programlisting>
EXECUTE DIRECT ON NODE dn1 'SELECT * FROM tenk1 WHERE col_char = ''foo''';
</programlisting>
  </para>

  <para>
   Select local timestamp of a remote node named coord2:
<programlisting>
EXECUTE DIRECT ON coord2 'select clock_timestamp()';
</programlisting>
  </para>

  <para>
   Select list of tables of a remote node named dn50:
<programlisting>
EXECUTE DIRECT ON dn50 'select tablename from pg_tables';
</programlisting>
  </para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>
  <para>
   <command>EXECUTE DIRECT</command> does not conform to the <acronym>
   SQL</acronym> standards, it is a Postgres-XL specific command.
  </para>
 </refsect1>

</refentry>