File: sql-createtablespace.html

package info (click to toggle)
pgadmin3 1.4.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 29,796 kB
  • ctags: 10,758
  • sloc: cpp: 55,356; sh: 6,164; ansic: 1,520; makefile: 576; sql: 482; xml: 100; perl: 18
file content (93 lines) | stat: -rw-r--r-- 4,604 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>CREATE TABLESPACE</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="sql-commands.html" title="SQL Commands">
<link rel="prev" href="sql-createtableas.html" title="CREATE TABLE AS">
<link rel="next" href="sql-createtrigger.html" title="CREATE TRIGGER">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
<a name="sql-createtablespace"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>CREATE TABLESPACE &#8212; define a new tablespace</p>
</div>
<a name="id764985"></a><div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">CREATE TABLESPACE <em class="replaceable"><code>tablespacename</code></em> [ OWNER <em class="replaceable"><code>username</code></em> ] LOCATION '<em class="replaceable"><code>directory</code></em>'</pre>
</div>
<div class="refsect1" lang="en">
<a name="id765022"></a><h2>Description</h2>
<p>   <code class="command">CREATE TABLESPACE</code> registers a new cluster-wide
   tablespace.  The tablespace name must be distinct from the name of any
   existing tablespace in the database cluster.
  </p>
<p>   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) may reside.
  </p>
<p>   A user with appropriate privileges can pass
   <em class="replaceable"><code>tablespacename</code></em> to
   <code class="command">CREATE DATABASE</code>, <code class="command">CREATE TABLE</code>,
   <code class="command">CREATE INDEX</code> or <code class="command">ADD CONSTRAINT</code> to have the data
   files for these objects stored within the specified tablespace.
  </p>
</div>
<div class="refsect1" lang="en">
<a name="id765082"></a><h2>Parameters</h2>
<div class="variablelist"><dl>
<dt><span class="term"><em class="replaceable"><code>tablespacename</code></em></span></dt>
<dd><p>        The name of a tablespace to be created.  The name cannot
        begin with <code class="literal">pg_</code>, as such names
        are reserved for system tablespaces.
       </p></dd>
<dt><span class="term"><em class="replaceable"><code>username</code></em></span></dt>
<dd><p>        The name of the user who will own the tablespace.  If omitted,
        defaults to the user executing the command.  Only superusers
        may create tablespaces, but they can assign ownership of tablespaces
        to non-superusers.
       </p></dd>
<dt><span class="term"><em class="replaceable"><code>directory</code></em></span></dt>
<dd><p>        The directory that will be used for the tablespace. The directory
        must be empty and must be owned by the
        <span class="productname">PostgreSQL</span> system user.  The directory must be
        specified by an absolute path name.
       </p></dd>
</dl></div>
</div>
<div class="refsect1" lang="en">
<a name="id765145"></a><h2>Notes</h2>
<p>   Tablespaces are only supported on systems that support symbolic links.
  </p>
</div>
<div class="refsect1" lang="en">
<a name="id765152"></a><h2>Examples</h2>
<p>   Create a tablespace <code class="literal">dbspace</code> at <code class="literal">/data/dbs</code>:
</p>
<pre class="programlisting">CREATE TABLESPACE dbspace LOCATION '/data/dbs';</pre>
<p>
  </p>
<p>   Create a tablespace <code class="literal">indexspace</code> at <code class="literal">/data/indexes</code>
   owned by user <code class="literal">genevieve</code>:
</p>
<pre class="programlisting">CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';</pre>
<p>
  </p>
</div>
<div class="refsect1" lang="en">
<a name="id765210"></a><h2>Compatibility</h2>
<p>   <code class="command">CREATE TABLESPACE</code> is a <span class="productname">PostgreSQL</span>
   extension.
  </p>
</div>
<div class="refsect1" lang="en">
<a name="id765230"></a><h2>See Also</h2>
<span class="simplelist"><a href="sql-createdatabase.html">CREATE DATABASE</a>, <a href="sql-createtable.html">CREATE TABLE</a>, <a href="sql-createindex.html">CREATE INDEX</a>, <a href="sql-droptablespace.html">DROP TABLESPACE</a>, <a href="sql-altertablespace.html">ALTER TABLESPACE</a></span>
</div>
</div></body>
</html>