GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CREATE_TABLESPACE (7)

.ds Aq ’

NAME

CREATE_TABLESPACE - define a new tablespace

CONTENTS

SYNOPSIS

CREATE TABLESPACE tablespace_name
    [ OWNER { new_owner | CURRENT_USER | SESSION_USER } ]
    LOCATION directory
    [ WITH ( tablespace_option = value [, ... ] ) ]

DESCRIPTION

CREATE TABLESPACE registers a new cluster-wide tablespace. The tablespace name must be distinct from the name of any existing tablespace in the database cluster.

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) can reside.

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

Warning

A tablespace cannot be used independently of the cluster in which it is defined; see Section 21.6, \(lqTablespaces\(rq, in the documentation.

PARAMETERS

tablespace_name

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

user_name

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

directory

The directory that will be used for the tablespace. The directory should be empty and must be owned by the PostgreSQL system user. The directory must be specified by an absolute path name.

tablespace_option

A tablespace parameter to be set or reset. Currently, the only available parameters are seq_page_cost and random_page_cost. Setting either value for a particular tablespace will override the planners usual estimate of the cost of reading pages from tables in that tablespace, as established by the configuration parameters of the same name (see seq_page_cost, random_page_cost). This may be useful if one tablespace is located on a disk which is faster or slower than the remainder of the I/O subsystem.

NOTES

Tablespaces are only supported on systems that support symbolic links.

CREATE TABLESPACE cannot be executed inside a transaction block.

EXAMPLES

Create a tablespace dbspace at /data/dbs:

CREATE TABLESPACE dbspace LOCATION /data/dbs;

Create a tablespace indexspace at /data/indexes owned by user genevieve:

CREATE TABLESPACE indexspace OWNER genevieve LOCATION /data/indexes;

COMPATIBILITY

CREATE TABLESPACE is a PostgreSQL extension.

SEE ALSO

CREATE DATABASE (CREATE_DATABASE(7)), CREATE TABLE (CREATE_TABLE(7)), CREATE INDEX (CREATE_INDEX(7)), DROP TABLESPACE (DROP_TABLESPACE(7)), ALTER TABLESPACE (ALTER_TABLESPACE(7))
Search for    or go to Top of page |  Section 7 |  Main Index


PostgreSQL 9.5.2 CREATE TABLESPACE (7) 2016

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.