| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/alter_tablespace.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-altertablespace"> |
| 7 |
<indexterm zone="sql-altertablespace"> |
| 8 |
<primary>ALTER TABLESPACE</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>ALTER TABLESPACE</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>ALTER TABLESPACE</refname> |
| 19 |
<refpurpose>change the definition of a tablespace</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<synopsis> |
| 24 |
ALTER TABLESPACE <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable> |
| 25 |
ALTER TABLESPACE <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } |
| 26 |
ALTER TABLESPACE <replaceable>name</replaceable> SET ( <replaceable class="parameter">tablespace_option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] ) |
| 27 |
ALTER TABLESPACE <replaceable>name</replaceable> RESET ( <replaceable class="parameter">tablespace_option</replaceable> [, ... ] ) |
| 28 |
</synopsis> |
| 29 |
</refsynopsisdiv> |
| 30 |
|
| 31 |
<refsect1> |
| 32 |
<title>Description</title> |
| 33 |
|
| 34 |
<para> |
| 35 |
<command>ALTER TABLESPACE</command> can be used to change the definition of |
| 36 |
a tablespace. |
| 37 |
</para> |
| 38 |
|
| 39 |
<para> |
| 40 |
You must own the tablespace to change the definition of a tablespace. |
| 41 |
To alter the owner, you must also be able to <literal>SET ROLE</literal> |
| 42 |
to the new owning role. |
| 43 |
(Note that superusers have these privileges automatically.) |
| 44 |
</para> |
| 45 |
|
| 46 |
</refsect1> |
| 47 |
|
| 48 |
<refsect1> |
| 49 |
<title>Parameters</title> |
| 50 |
|
| 51 |
<variablelist> |
| 52 |
<varlistentry> |
| 53 |
<term><replaceable class="parameter">name</replaceable></term> |
| 54 |
<listitem> |
| 55 |
<para> |
| 56 |
The name of an existing tablespace. |
| 57 |
</para> |
| 58 |
</listitem> |
| 59 |
</varlistentry> |
| 60 |
|
| 61 |
<varlistentry> |
| 62 |
<term><replaceable class="parameter">new_name</replaceable></term> |
| 63 |
<listitem> |
| 64 |
<para> |
| 65 |
The new name of the tablespace. The new name cannot |
| 66 |
begin with <literal>pg_</literal>, as such names |
| 67 |
are reserved for system tablespaces. |
| 68 |
</para> |
| 69 |
</listitem> |
| 70 |
</varlistentry> |
| 71 |
|
| 72 |
<varlistentry> |
| 73 |
<term><replaceable class="parameter">new_owner</replaceable></term> |
| 74 |
<listitem> |
| 75 |
<para> |
| 76 |
The new owner of the tablespace. |
| 77 |
</para> |
| 78 |
</listitem> |
| 79 |
</varlistentry> |
| 80 |
|
| 81 |
<varlistentry> |
| 82 |
<term><replaceable class="parameter">tablespace_option</replaceable></term> |
| 83 |
<listitem> |
| 84 |
<para> |
| 85 |
A tablespace parameter to be set or reset. Currently, the only |
| 86 |
available parameters are <varname>seq_page_cost</varname>, |
| 87 |
<varname>random_page_cost</varname>, <varname>effective_io_concurrency</varname> |
| 88 |
and <varname>maintenance_io_concurrency</varname>. |
| 89 |
Setting these values for a particular tablespace will override the |
| 90 |
planner's usual estimate of the cost of reading pages from tables in |
| 91 |
that tablespace, and how many concurrent I/Os are issued, as established |
| 92 |
by the configuration parameters of the |
| 93 |
same name (see <xref linkend="guc-seq-page-cost"/>, |
| 94 |
<xref linkend="guc-random-page-cost"/>, |
| 95 |
<xref linkend="guc-effective-io-concurrency"/>, |
| 96 |
<xref linkend="guc-maintenance-io-concurrency"/>). This may be useful if |
| 97 |
one tablespace is located on a disk which is faster or slower than the |
| 98 |
remainder of the I/O subsystem. |
| 99 |
</para> |
| 100 |
</listitem> |
| 101 |
</varlistentry> |
| 102 |
|
| 103 |
</variablelist> |
| 104 |
</refsect1> |
| 105 |
|
| 106 |
<refsect1> |
| 107 |
<title>Examples</title> |
| 108 |
|
| 109 |
<para> |
| 110 |
Rename tablespace <literal>index_space</literal> to <literal>fast_raid</literal>: |
| 111 |
<programlisting> |
| 112 |
ALTER TABLESPACE index_space RENAME TO fast_raid; |
| 113 |
</programlisting> |
| 114 |
</para> |
| 115 |
|
| 116 |
<para> |
| 117 |
Change the owner of tablespace <literal>index_space</literal>: |
| 118 |
<programlisting> |
| 119 |
ALTER TABLESPACE index_space OWNER TO mary; |
| 120 |
</programlisting></para> |
| 121 |
</refsect1> |
| 122 |
|
| 123 |
<refsect1> |
| 124 |
<title>Compatibility</title> |
| 125 |
|
| 126 |
<para> |
| 127 |
There is no <command>ALTER TABLESPACE</command> statement in |
| 128 |
the SQL standard. |
| 129 |
</para> |
| 130 |
</refsect1> |
| 131 |
|
| 132 |
<refsect1> |
| 133 |
<title>See Also</title> |
| 134 |
|
| 135 |
<simplelist type="inline"> |
| 136 |
<member><xref linkend="sql-createtablespace"/></member> |
| 137 |
<member><xref linkend="sql-droptablespace"/></member> |
| 138 |
</simplelist> |
| 139 |
</refsect1> |
| 140 |
</refentry> |