mirror of
https://github.com/postgres/postgres.git
synced 2025-05-11 05:41:32 +03:00
Standard English uses "may", "can", and "might" in different ways: may - permission, "You may borrow my rake." can - ability, "I can lift that log." might - possibility, "It might rain today." Unfortunately, in conversational English, their use is often mixed, as in, "You may use this variable to do X", when in fact, "can" is a better choice. Similarly, "It may crash" is better stated, "It might crash".
146 lines
4.2 KiB
Plaintext
146 lines
4.2 KiB
Plaintext
<!--
|
|
$PostgreSQL: pgsql/doc/src/sgml/ref/create_tablespace.sgml,v 1.8 2007/01/31 23:26:03 momjian Exp $
|
|
PostgreSQL documentation
|
|
-->
|
|
|
|
<refentry id="SQL-CREATETABLESPACE">
|
|
<refmeta>
|
|
<refentrytitle id="sql-createtablespace-title">CREATE TABLESPACE</refentrytitle>
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
<refname>CREATE TABLESPACE</refname>
|
|
<refpurpose>define a new tablespace</refpurpose>
|
|
</refnamediv>
|
|
|
|
<indexterm zone="sql-createtablespace">
|
|
<primary>CREATE TABLESPACE</primary>
|
|
</indexterm>
|
|
|
|
<refsynopsisdiv>
|
|
<synopsis>
|
|
CREATE TABLESPACE <replaceable class="parameter">tablespacename</replaceable> [ OWNER <replaceable class="parameter">username</replaceable> ] LOCATION '<replaceable class="parameter">directory</replaceable>'
|
|
</synopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsect1>
|
|
<title>Description</title>
|
|
|
|
<para>
|
|
<command>CREATE TABLESPACE</command> registers a new cluster-wide
|
|
tablespace. The tablespace name must be distinct from the name of any
|
|
existing tablespace in the database cluster.
|
|
</para>
|
|
|
|
<para>
|
|
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.
|
|
</para>
|
|
|
|
<para>
|
|
A user with appropriate privileges can pass
|
|
<replaceable class="parameter">tablespacename</> to
|
|
<command>CREATE DATABASE</>, <command>CREATE TABLE</>,
|
|
<command>CREATE INDEX</> or <command>ADD CONSTRAINT</> to have the data
|
|
files for these objects stored within the specified tablespace.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1>
|
|
<title>Parameters</title>
|
|
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><replaceable class="parameter">tablespacename</replaceable></term>
|
|
<listitem>
|
|
<para>
|
|
The name of a tablespace to be created. The name cannot
|
|
begin with <literal>pg_</literal>, as such names
|
|
are reserved for system tablespaces.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><replaceable class="parameter">username</replaceable></term>
|
|
<listitem>
|
|
<para>
|
|
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.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><replaceable class="parameter">directory</replaceable></term>
|
|
<listitem>
|
|
<para>
|
|
The directory that will be used for the tablespace. The directory
|
|
must be empty and must be owned by the
|
|
<productname>PostgreSQL</> system user. The directory must be
|
|
specified by an absolute path name.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1>
|
|
<title>Notes</title>
|
|
|
|
<para>
|
|
Tablespaces are only supported on systems that support symbolic links.
|
|
</para>
|
|
|
|
<para>
|
|
<command>CREATE TABLESPACE</> cannot be executed inside a transaction
|
|
block.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1>
|
|
<title>Examples</title>
|
|
|
|
<para>
|
|
Create a tablespace <literal>dbspace</> at <literal>/data/dbs</>:
|
|
<programlisting>
|
|
CREATE TABLESPACE dbspace LOCATION '/data/dbs';
|
|
</programlisting>
|
|
</para>
|
|
|
|
<para>
|
|
Create a tablespace <literal>indexspace</> at <literal>/data/indexes</>
|
|
owned by user <literal>genevieve</>:
|
|
<programlisting>
|
|
CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';
|
|
</programlisting>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1>
|
|
<title>Compatibility</title>
|
|
|
|
<para>
|
|
<command>CREATE TABLESPACE</command> is a <productname>PostgreSQL</>
|
|
extension.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1>
|
|
<title>See Also</title>
|
|
|
|
<simplelist type="inline">
|
|
<member><xref linkend="sql-createdatabase" endterm="sql-createdatabase-title"></member>
|
|
<member><xref linkend="sql-createtable" endterm="sql-createtable-title"></member>
|
|
<member><xref linkend="sql-createindex" endterm="sql-createindex-title"></member>
|
|
<member><xref linkend="sql-droptablespace" endterm="sql-droptablespace-title"></member>
|
|
<member><xref linkend="sql-altertablespace" endterm="sql-altertablespace-title"></member>
|
|
</simplelist>
|
|
</refsect1>
|
|
|
|
</refentry>
|