mirror of
https://github.com/postgres/postgres.git
synced 2025-05-11 05:41:32 +03:00
Fix some now-obsolete comments about the space used by various data
types.
This commit is contained in:
parent
e1f1a5358b
commit
146c83c045
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.59 2007/03/02 06:01:01 tgl Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.60 2007/04/06 19:22:38 tgl Exp $ -->
|
||||||
|
|
||||||
<sect1 id="arrays">
|
<sect1 id="arrays">
|
||||||
<title>Arrays</title>
|
<title>Arrays</title>
|
||||||
@ -10,8 +10,8 @@
|
|||||||
<para>
|
<para>
|
||||||
<productname>PostgreSQL</productname> allows columns of a table to be
|
<productname>PostgreSQL</productname> allows columns of a table to be
|
||||||
defined as variable-length multidimensional arrays. Arrays of any
|
defined as variable-length multidimensional arrays. Arrays of any
|
||||||
built-in or user-defined base type can be created. (Arrays of
|
built-in or user-defined base type or enum type can be created.
|
||||||
composite types or domains are not yet supported, however.)
|
(Arrays of composite types or domains are not yet supported, however.)
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.194 2007/04/05 01:46:27 momjian Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.195 2007/04/06 19:22:38 tgl Exp $ -->
|
||||||
|
|
||||||
<chapter id="datatype">
|
<chapter id="datatype">
|
||||||
<title id="datatype-title">Data Types</title>
|
<title id="datatype-title">Data Types</title>
|
||||||
@ -516,7 +516,7 @@ NUMERIC
|
|||||||
type is more akin to <type>varchar(<replaceable>n</>)</type>
|
type is more akin to <type>varchar(<replaceable>n</>)</type>
|
||||||
than to <type>char(<replaceable>n</>)</type>.) The actual storage
|
than to <type>char(<replaceable>n</>)</type>.) The actual storage
|
||||||
requirement is two bytes for each group of four decimal digits,
|
requirement is two bytes for each group of four decimal digits,
|
||||||
plus eight bytes overhead.
|
plus five to eight bytes overhead.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<indexterm>
|
<indexterm>
|
||||||
@ -842,9 +842,9 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
|
|||||||
<tbody>
|
<tbody>
|
||||||
<row>
|
<row>
|
||||||
<entry>money</entry>
|
<entry>money</entry>
|
||||||
<entry>4 bytes</entry>
|
<entry>8 bytes</entry>
|
||||||
<entry>currency amount</entry>
|
<entry>currency amount</entry>
|
||||||
<entry>-21474836.48 to +21474836.47</entry>
|
<entry>-92233720368547758.08 to +92233720368547758.07</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
@ -975,12 +975,13 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The storage requirement for data of these types is 4 bytes plus the
|
The storage requirement for a short string (up to 126 bytes) is 1 byte
|
||||||
actual string, and in case of <type>character</type> plus the
|
plus the actual string, which includes the space padding in the case of
|
||||||
padding. Long strings are compressed by the system automatically, so
|
<type>character</type>. Longer strings have 4 bytes overhead instead
|
||||||
the physical requirement on disk might be less. Long values are also
|
of 1. Long strings are compressed by the system automatically, so
|
||||||
stored in background tables so they do not interfere with rapid
|
the physical requirement on disk might be less. Very long values are also
|
||||||
access to the shorter column values. In any case, the longest
|
stored in background tables so that they do not interfere with rapid
|
||||||
|
access to shorter column values. In any case, the longest
|
||||||
possible character string that can be stored is about 1 GB. (The
|
possible character string that can be stored is about 1 GB. (The
|
||||||
maximum value that will be allowed for <replaceable>n</> in the data
|
maximum value that will be allowed for <replaceable>n</> in the data
|
||||||
type declaration is less than that. It wouldn't be very useful to
|
type declaration is less than that. It wouldn't be very useful to
|
||||||
@ -994,8 +995,10 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
|
|||||||
<tip>
|
<tip>
|
||||||
<para>
|
<para>
|
||||||
There are no performance differences between these three types,
|
There are no performance differences between these three types,
|
||||||
apart from the increased storage size when using the blank-padded
|
apart from increased storage size when using the blank-padded
|
||||||
type. While <type>character(<replaceable>n</>)</type> has performance
|
type, and a few extra cycles to check the length when storing into
|
||||||
|
a length-constrained column. While
|
||||||
|
<type>character(<replaceable>n</>)</type> has performance
|
||||||
advantages in some other database systems, it has no such advantages in
|
advantages in some other database systems, it has no such advantages in
|
||||||
<productname>PostgreSQL</productname>. In most situations
|
<productname>PostgreSQL</productname>. In most situations
|
||||||
<type>text</type> or <type>character varying</type> should be used
|
<type>text</type> or <type>character varying</type> should be used
|
||||||
@ -1080,7 +1083,7 @@ SELECT b, char_length(b) FROM test2;
|
|||||||
<row>
|
<row>
|
||||||
<entry><type>"char"</type></entry>
|
<entry><type>"char"</type></entry>
|
||||||
<entry>1 byte</entry>
|
<entry>1 byte</entry>
|
||||||
<entry>single-character internal type</entry>
|
<entry>single-byte internal type</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><type>name</type></entry>
|
<entry><type>name</type></entry>
|
||||||
@ -1122,7 +1125,7 @@ SELECT b, char_length(b) FROM test2;
|
|||||||
<tbody>
|
<tbody>
|
||||||
<row>
|
<row>
|
||||||
<entry><type>bytea</type></entry>
|
<entry><type>bytea</type></entry>
|
||||||
<entry>4 bytes plus the actual binary string</entry>
|
<entry>1 or 4 bytes plus the actual binary string</entry>
|
||||||
<entry>variable-length binary string</entry>
|
<entry>variable-length binary string</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -2879,13 +2882,13 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
|
|||||||
|
|
||||||
<row>
|
<row>
|
||||||
<entry><type>cidr</type></entry>
|
<entry><type>cidr</type></entry>
|
||||||
<entry>12 or 24 bytes</entry>
|
<entry>7 or 19 bytes</entry>
|
||||||
<entry>IPv4 and IPv6 networks</entry>
|
<entry>IPv4 and IPv6 networks</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<entry><type>inet</type></entry>
|
<entry><type>inet</type></entry>
|
||||||
<entry>12 or 24 bytes</entry>
|
<entry>7 or 19 bytes</entry>
|
||||||
<entry>IPv4 and IPv6 hosts and networks</entry>
|
<entry>IPv4 and IPv6 hosts and networks</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
@ -3188,6 +3191,12 @@ SELECT * FROM test;
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
A bit string value requires 1 byte for each group of 8 bits, plus
|
||||||
|
5 or 8 bytes overhead depending on the length of the string
|
||||||
|
(but long values may be compressed or moved out-of-line, as explained
|
||||||
|
in <xref linkend="datatype-character"> for character strings).
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="datatype-xml">
|
<sect1 id="datatype-xml">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user