CREATE TABLESPACE
This page documents the preview version (v2.21). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.
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'= ... ] } ) ]
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.