mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Allow specifying STORAGE attribute for a new table
Previously, the STORAGE specification was only available in ALTER TABLE. This makes it available in CREATE TABLE as well. Also make the code and the documentation for STORAGE and COMPRESSION attributes consistent. Author: Teodor Sigaev <teodor@sigaev.ru> Author: Aleksander Alekseev <aleksander@timescale.com> Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Reviewed-by: wenjing zeng <wjzeng2012@gmail.com> Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/de83407a-ae3d-a8e1-a788-920eb334f25b@sigaev.ru
This commit is contained in:
@ -367,7 +367,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<literal>SET STORAGE</literal>
|
||||
<literal>SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }</literal>
|
||||
<indexterm>
|
||||
<primary>TOAST</primary>
|
||||
<secondary>per-column storage settings</secondary>
|
||||
|
@ -22,7 +22,7 @@ PostgreSQL documentation
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] <replaceable class="parameter">table_name</replaceable> ( [
|
||||
{ <replaceable class="parameter">column_name</replaceable> <replaceable class="parameter">data_type</replaceable> [ COMPRESSION <replaceable>compression_method</replaceable> ] [ COLLATE <replaceable>collation</replaceable> ] [ <replaceable class="parameter">column_constraint</replaceable> [ ... ] ]
|
||||
{ <replaceable class="parameter">column_name</replaceable> <replaceable class="parameter">data_type</replaceable> [ STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } ] [ COMPRESSION <replaceable>compression_method</replaceable> ] [ COLLATE <replaceable>collation</replaceable> ] [ <replaceable class="parameter">column_constraint</replaceable> [ ... ] ]
|
||||
| <replaceable>table_constraint</replaceable>
|
||||
| LIKE <replaceable>source_table</replaceable> [ <replaceable>like_option</replaceable> ... ] }
|
||||
[, ... ]
|
||||
@ -297,6 +297,33 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<literal>STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }</literal>
|
||||
<indexterm>
|
||||
<primary>TOAST</primary>
|
||||
<secondary>per-column storage settings</secondary>
|
||||
</indexterm>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This form sets the storage mode for the column. This controls whether this
|
||||
column is held inline or in a secondary <acronym>TOAST</acronym> table,
|
||||
and whether the data should be compressed or not. <literal>PLAIN</literal>
|
||||
must be used for fixed-length values such as <type>integer</type> and is
|
||||
inline, uncompressed. <literal>MAIN</literal> is for inline, compressible
|
||||
data. <literal>EXTERNAL</literal> is for external, uncompressed data, and
|
||||
<literal>EXTENDED</literal> is for external, compressed data.
|
||||
<literal>EXTENDED</literal> is the default for most data types that
|
||||
support non-<literal>PLAIN</literal> storage. Use of
|
||||
<literal>EXTERNAL</literal> will make substring operations on very large
|
||||
<type>text</type> and <type>bytea</type> values run faster, at the penalty
|
||||
of increased storage space. See <xref linkend="storage-toast"/> for more
|
||||
information.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term>
|
||||
<listitem>
|
||||
|
Reference in New Issue
Block a user