1CREATE TABLESPACE(7) PostgreSQL 9.2.24 Documentation CREATE TABLESPACE(7)
2
3
4
6 CREATE_TABLESPACE - define a new tablespace
7
9 CREATE TABLESPACE tablespace_name [ OWNER user_name ] LOCATION 'directory'
10
12 CREATE TABLESPACE registers a new cluster-wide tablespace. The
13 tablespace name must be distinct from the name of any existing
14 tablespace in the database cluster.
15
16 A tablespace allows superusers to define an alternative location on the
17 file system where the data files containing database objects (such as
18 tables and indexes) can reside.
19
20 A user with appropriate privileges can pass tablespace_name to CREATE
21 DATABASE, CREATE TABLE, CREATE INDEX or ADD CONSTRAINT to have the data
22 files for these objects stored within the specified tablespace.
23
25 tablespace_name
26 The name of a tablespace to be created. The name cannot begin with
27 pg_, as such names are reserved for system tablespaces.
28
29 user_name
30 The name of the user who will own the tablespace. If omitted,
31 defaults to the user executing the command. Only superusers can
32 create tablespaces, but they can assign ownership of tablespaces to
33 non-superusers.
34
35 directory
36 The directory that will be used for the tablespace. The directory
37 should be empty and must be owned by the PostgreSQL system user.
38 The directory must be specified by an absolute path name.
39
41 Tablespaces are only supported on systems that support symbolic links.
42
43 CREATE TABLESPACE cannot be executed inside a transaction block.
44
46 Create a tablespace dbspace at /data/dbs:
47
48 CREATE TABLESPACE dbspace LOCATION '/data/dbs';
49
50 Create a tablespace indexspace at /data/indexes owned by user
51 genevieve:
52
53 CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';
54
56 CREATE TABLESPACE is a PostgreSQL extension.
57
59 CREATE DATABASE (CREATE_DATABASE(7)), CREATE TABLE (CREATE_TABLE(7)),
60 CREATE INDEX (CREATE_INDEX(7)), DROP TABLESPACE (DROP_TABLESPACE(7)),
61 ALTER TABLESPACE (ALTER_TABLESPACE(7))
62
63
64
65PostgreSQL 9.2.24 2017-11-06 CREATE TABLESPACE(7)