1CREATE TABLESPACE(7) SQL Commands CREATE TABLESPACE(7)
2
3
4
6 CREATE TABLESPACE - define a new tablespace
7
8
10 CREATE TABLESPACE tablespacename [ OWNER username ] LOCATION 'directory'
11
12
14 CREATE TABLESPACE registers a new cluster-wide tablespace. The
15 tablespace name must be distinct from the name of any existing
16 tablespace in the database cluster.
17
18 A tablespace allows superusers to define an alternative location on the
19 file system where the data files containing database objects (such as
20 tables and indexes) can reside.
21
22 A user with appropriate privileges can pass tablespacename to CREATE
23 DATABASE, CREATE TABLE, CREATE INDEX or ADD CONSTRAINT to have the data
24 files for these objects stored within the specified tablespace.
25
27 tablespacename
28 The name of a tablespace to be created. The name cannot begin
29 with pg_, as such names are reserved for system tablespaces.
30
31 username
32 The name of the user who will own the tablespace. If omitted,
33 defaults to the user executing the command. Only superusers can
34 create tablespaces, but they can assign ownership of tablespaces
35 to non-superusers.
36
37 directory
38 The directory that will be used for the tablespace. The direcā
39 tory must be empty and must be owned by the PostgreSQL system
40 user. The directory must be specified by an absolute path name.
41
43 Tablespaces are only supported on systems that support symbolic links.
44
45 CREATE TABLESPACE cannot be executed inside a transaction block.
46
48 Create a tablespace dbspace at /data/dbs:
49
50 CREATE TABLESPACE dbspace LOCATION '/data/dbs';
51
52
53 Create a tablespace indexspace at /data/indexes owned by user
54 genevieve:
55
56 CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';
57
58
60 CREATE TABLESPACE is a PostgreSQL extension.
61
63 CREATE DATABASE [create_database(7)], CREATE TABLE [create_table(7)],
64 CREATE INDEX [create_index(7)], DROP TABLESPACE [drop_tablespace(7)],
65 ALTER TABLESPACE [alter_tablespace(7)]
66
67
68
69SQL - Language Statements 2014-02-17 CREATE TABLESPACE(7)