Table creation with default data distribution
There is a default placement of the data segments of new tables on the devices in a cluster. The default is that new tables are given 3 data segments on every device. As an example, this is aCREATE TABLE
statement with default data segment placement:
SHOW TABLES
statement. The --output-file
option of the client_cli
command can be used to get untruncated output. The TABLE_METADATA
field shows the equivalent CREATE TABLE
statement that would explicitly define the table layout. In the example cluster that has 3 nodes each with 3 devices, the above CREATE TABLE
command is equivalent to the following command that specifies the segments and their locations explicitly:
Overriding the default table creation parameters
You can override those defaults. You can decide to place more or fewer segments on a device, or place segments only on a subset of the devices. For example, this may be done in order to avoid using a device which is already nearly full. As another example, you may know that a table will always remain small, in which case the wide distribution of data across many nodes/devices creates more overhead that outweighs the parallel execution in terms of performance. To take control of the distribution of segments to devices, aWITH DEVICES
clause is added to the CREATE TABLE
, as shown in the output of SHOW TABLES
above. Below is an example of a CREATE TABLE
command with a WITH DEVICES
clause specifying 3 data segments on 2 storage devices: