Creating tablespace in Greenplum Database

CREATE TABLESPACE command is used to create a new tablespace in Greenplum database.


CREATE TABLESPACE tablespace_name [OWNER username] FILESPACE filespace_name


CREATE TABLESPACE registers a new tablespace for your Greenplum Database system. The tablespace name must be distinct from the name of any existing tablespace in the system. A tablespace allows superusers to define an alternative location on the file system where the data files containing database objects (such as tables and indexes) may reside.

A user with appropriate privileges can pass a tablespace name to CREATE DATABASE, CREATE TABLE, or CREATE INDEX to have the data files for these objects stored within the specified tablespace.

In Greenplum Database, there must be a file system location defined for the master, each primary segment, and each mirror segment in order for the tablespace to have a location to store its objects across an entire Greenplum system. This collection of file system locations is defined in a filespace object. A filespace must be defined before you can create a tablespace. 


The name of a tablespace to be created. The name cannot begin with pg_ or gp_, as
such names are reserved for system tablespaces.

OWNER username
The name of the user who will own the tablespace. If omitted, defaults to the user
executing the command. Only superusers may create tablespaces, but they can
assign ownership of tablespaces to non-superusers.

The name of a Greenplum Database filespace that was defined using the CREATE
FILESPACE command or the gpfilespace management utility.