1CREATE TABLESPACE(7)     PostgreSQL 10.7 Documentation    CREATE TABLESPACE(7)
2
3
4

NAME

6       CREATE_TABLESPACE - define a new tablespace
7

SYNOPSIS

9       CREATE TABLESPACE tablespace_name
10           [ OWNER { new_owner | CURRENT_USER | SESSION_USER } ]
11           LOCATION 'directory'
12           [ WITH ( tablespace_option = value [, ... ] ) ]
13

DESCRIPTION

15       CREATE TABLESPACE registers a new cluster-wide tablespace. The
16       tablespace name must be distinct from the name of any existing
17       tablespace in the database cluster.
18
19       A tablespace allows superusers to define an alternative location on the
20       file system where the data files containing database objects (such as
21       tables and indexes) can reside.
22
23       A user with appropriate privileges can pass tablespace_name to CREATE
24       DATABASE, CREATE TABLE, CREATE INDEX or ADD CONSTRAINT to have the data
25       files for these objects stored within the specified tablespace.
26
27           Warning
28           A tablespace cannot be used independently of the cluster in which
29           it is defined; see Section 22.6.
30

PARAMETERS

32       tablespace_name
33           The name of a tablespace to be created. The name cannot begin with
34           pg_, as such names are reserved for system tablespaces.
35
36       user_name
37           The name of the user who will own the tablespace. If omitted,
38           defaults to the user executing the command. Only superusers can
39           create tablespaces, but they can assign ownership of tablespaces to
40           non-superusers.
41
42       directory
43           The directory that will be used for the tablespace. The directory
44           should be empty and must be owned by the PostgreSQL system user.
45           The directory must be specified by an absolute path name.
46
47       tablespace_option
48           A tablespace parameter to be set or reset. Currently, the only
49           available parameters are seq_page_cost, random_page_cost and
50           effective_io_concurrency. Setting either value for a particular
51           tablespace will override the planner's usual estimate of the cost
52           of reading pages from tables in that tablespace, as established by
53           the configuration parameters of the same name (see seq_page_cost,
54           random_page_cost, effective_io_concurrency). This may be useful if
55           one tablespace is located on a disk which is faster or slower than
56           the remainder of the I/O subsystem.
57

NOTES

59       Tablespaces are only supported on systems that support symbolic links.
60
61       CREATE TABLESPACE cannot be executed inside a transaction block.
62

EXAMPLES

64       Create a tablespace dbspace at /data/dbs:
65
66           CREATE TABLESPACE dbspace LOCATION '/data/dbs';
67
68       Create a tablespace indexspace at /data/indexes owned by user
69       genevieve:
70
71           CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';
72

COMPATIBILITY

74       CREATE TABLESPACE is a PostgreSQL extension.
75

SEE ALSO

77       CREATE DATABASE (CREATE_DATABASE(7)), CREATE TABLE (CREATE_TABLE(7)),
78       CREATE INDEX (CREATE_INDEX(7)), DROP TABLESPACE (DROP_TABLESPACE(7)),
79       ALTER TABLESPACE (ALTER_TABLESPACE(7))
80
81
82
83PostgreSQL 10.7                      2019                 CREATE TABLESPACE(7)
Impressum