attach_data_node()

Attach a data node to a hypertable. The data node should have been previously created using add_data_node.

When a distributed hypertable is created it will by default use all available data nodes for the hypertable, but if a data node is added after a hypertable is created, the data node will not automatically be used by existing distributed hypertables.

If you want a hypertable to use a data node that was created later, you must attach the data node to the hypertable using this function.

Required Arguments

NameDescription
node_nameName of data node to attach
hypertableName of distributed hypertable to attach node to

Optional Arguments

NameDescription
if_not_attachedPrevents error if the data node is already attached to the hypertable. A notice will be printed that the data node is attached. Defaults to FALSE.
repartitionChange the partitioning configuration so that all the attached data nodes are used. Defaults to TRUE.

Returns

ColumnDescription
hypertable_idHypertable id of the modified hypertable
node_hypertable_idHypertable id on the remote data node
node_nameName of the attached data node

Sample Usage

Attach a data node dn3 to a distributed hypertable conditions previously created with create_distributed_hypertable.

  1. SELECT * FROM attach_data_node('dn3','conditions');
  2. hypertable_id | node_hypertable_id | node_name
  3. --------------+--------------------+-------------
  4. 5 | 3 | dn3
  5. (1 row)

TIP:You must add a data node to your distributed database first with add_data_node first before attaching it.