Assigning Tables to Server Groups

When you create a new table, the CREATE TABLE statement can specify the server groups to which the table belongs.

Data for a partitioned table is spread across all of the members of the specified server group. Data for a replicated table is replicated to all members of the server group. See Replicating Tables.

For example, the following command creates a replicated where the table's data is hosted on two server groups:
CREATE TABLE COUNTRIES
(
  COUNTRY VARCHAR(26) NOT NULL,
  COUNTRY_ISO_CODE CHAR(2) NOT PRIMARY KEY,
  REGION VARCHAR(26),
) SERVER GROUPS (OrdersDB, OrdersReplicationGrp)
Tables in GemFire XD are replicated by default if you do not specify partitioning.

If you do not specify one or more server group names, the table data is partitioned or replicated across all members of the default server group for that schema. This behavior may not be desirable in all situations. For example, if the data in a replicated table changes frequently, the cost of maintaining a copy on each server in the default group may be prohibitive. In this case, the application developer or system administrator can have several members participate in a new, smaller server group to limit the number of replicas.

When two tables are partitioned and colocated, it forces partitions that have the same values for those columns in the two tables to be located on the same member. Colocated tables must belong to at least one common server group. As a best practice, you deploy colocated tables on exactly the same server groups. See Partitioning Tables.