The directory that will be used for the tablespace. The directory
- should be empty and must be owned by the
+ must exist (CREATE TABLESPACE will not create it),
+ should be empty, and must be owned by the
PostgreSQL system user. The directory must be
specified by an absolute path name.
Examples
- Create a tablespace dbspace at /data/dbs:
+ To create a tablespace dbspace at file system location
+ /data/dbs, first create the directory using operating
+ system facilities and set the correct ownership:
+mkdir /data/dbs
+chown postgres:postgres /data/dbs
+
+ Then issue the tablespace creation command inside
CREATE TABLESPACE dbspace LOCATION '/data/dbs';
- Create a tablespace indexspace at /data/indexes
- owned by user genevieve:
+ To create a tablespace owned by a different database user, use a command
+ like this:
CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';