CREATE TABLESPACE

Synopsis

Use the CREATE TABLESPACE statement to create a tablespace in the cluster. It defines the tablespace name and tablespace properties.

Syntax

create_tablespace ::= CREATE TABLESPACE tablespace_name 
                      [ WITH ( 
                        { 'tablespace_option' = value 
                        [ ,'tablespace_option'= ... ] } ) ]

create_tablespace

CREATETABLESPACEtablespace_nameWITH(tablespace_option=value,tablespace_option=value)

Semantics

  • Create a tablespace with tablespace_name. If qualified_name already exists in the cluster, an error will be raised.
  • YSQL tablespaces allow administrators to specify the number of replicas for a table or index, and how they can be distributed across a set of clouds, regions, and zones in a geo-distributed deployment.

tablespace_option

  • Can be one of [replica_placement].
  • Use replica_placement to specify the number of replicas stored in specific zones, regions, or clouds.

Examples

See Tablespaces and Row Level Geo Partitioning for full guides.

See also