Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit146c83c

Browse files
committed
Fix some now-obsolete comments about the space used by various data
types.
1 parente1f1a53 commit146c83c

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

‎doc/src/sgml/array.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.59 2007/03/02 06:01:01 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.60 2007/04/06 19:22:38 tgl Exp $ -->
22

33
<sect1 id="arrays">
44
<title>Arrays</title>
@@ -10,8 +10,8 @@
1010
<para>
1111
<productname>PostgreSQL</productname> allows columns of a table to be
1212
defined as variable-length multidimensional arrays. Arrays of any
13-
built-in or user-defined base type can be created. (Arrays of
14-
composite types or domains are not yet supported, however.)
13+
built-in or user-defined base typeor enum typecan be created.
14+
(Arrays ofcomposite types or domains are not yet supported, however.)
1515
</para>
1616

1717
<sect2>

‎doc/src/sgml/datatype.sgml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.194 2007/04/05 01:46:27 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.195 2007/04/06 19:22:38 tgl Exp $ -->
22

33
<chapter id="datatype">
44
<title id="datatype-title">Data Types</title>
@@ -516,7 +516,7 @@ NUMERIC
516516
type is more akin to <type>varchar(<replaceable>n</>)</type>
517517
than to <type>char(<replaceable>n</>)</type>.) The actual storage
518518
requirement is two bytes for each group of four decimal digits,
519-
plus eight bytes overhead.
519+
plusfive toeight bytes overhead.
520520
</para>
521521

522522
<indexterm>
@@ -842,9 +842,9 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
842842
<tbody>
843843
<row>
844844
<entry>money</entry>
845-
<entry>4 bytes</entry>
845+
<entry>8 bytes</entry>
846846
<entry>currency amount</entry>
847-
<entry>-21474836.48 to +21474836.47</entry>
847+
<entry>-92233720368547758.08 to +92233720368547758.07</entry>
848848
</row>
849849
</tbody>
850850
</tgroup>
@@ -975,12 +975,13 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
975975
</para>
976976

977977
<para>
978-
The storage requirement for data of these types is 4 bytes plus the
979-
actual string, and in case of <type>character</type> plus the
980-
padding. Long strings are compressed by the system automatically, so
981-
the physical requirement on disk might be less. Long values are also
982-
stored in background tables so they do not interfere with rapid
983-
access to the shorter column values. In any case, the longest
978+
The storage requirement for a short string (up to 126 bytes) is 1 byte
979+
plus the actual string, which includes the space padding in the case of
980+
<type>character</type>. Longer strings have 4 bytes overhead instead
981+
of 1. Long strings are compressed by the system automatically, so
982+
the physical requirement on disk might be less. Very long values are also
983+
stored in background tables so that they do not interfere with rapid
984+
access to shorter column values. In any case, the longest
984985
possible character string that can be stored is about 1 GB. (The
985986
maximum value that will be allowed for <replaceable>n</> in the data
986987
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
994995
<tip>
995996
<para>
996997
There are no performance differences between these three types,
997-
apart from the increased storage size when using the blank-padded
998-
type. While <type>character(<replaceable>n</>)</type> has performance
998+
apart from increased storage size when using the blank-padded
999+
type, and a few extra cycles to check the length when storing into
1000+
a length-constrained column. While
1001+
<type>character(<replaceable>n</>)</type> has performance
9991002
advantages in some other database systems, it has no such advantages in
10001003
<productname>PostgreSQL</productname>. In most situations
10011004
<type>text</type> or <type>character varying</type> should be used
@@ -1080,7 +1083,7 @@ SELECT b, char_length(b) FROM test2;
10801083
<row>
10811084
<entry><type>"char"</type></entry>
10821085
<entry>1 byte</entry>
1083-
<entry>single-character internal type</entry>
1086+
<entry>single-byte internal type</entry>
10841087
</row>
10851088
<row>
10861089
<entry><type>name</type></entry>
@@ -1122,7 +1125,7 @@ SELECT b, char_length(b) FROM test2;
11221125
<tbody>
11231126
<row>
11241127
<entry><type>bytea</type></entry>
1125-
<entry>4 bytes plus the actual binary string</entry>
1128+
<entry>1 or4 bytes plus the actual binary string</entry>
11261129
<entry>variable-length binary string</entry>
11271130
</row>
11281131
</tbody>
@@ -2879,13 +2882,13 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
28792882

28802883
<row>
28812884
<entry><type>cidr</type></entry>
2882-
<entry>12 or24 bytes</entry>
2885+
<entry>7 or19 bytes</entry>
28832886
<entry>IPv4 and IPv6 networks</entry>
28842887
</row>
28852888

28862889
<row>
28872890
<entry><type>inet</type></entry>
2888-
<entry>12 or24 bytes</entry>
2891+
<entry>7 or19 bytes</entry>
28892892
<entry>IPv4 and IPv6 hosts and networks</entry>
28902893
</row>
28912894

@@ -3188,6 +3191,12 @@ SELECT * FROM test;
31883191
</programlisting>
31893192
</example>
31903193

3194+
<para>
3195+
A bit string value requires 1 byte for each group of 8 bits, plus
3196+
5 or 8 bytes overhead depending on the length of the string
3197+
(but long values may be compressed or moved out-of-line, as explained
3198+
in <xref linkend="datatype-character"> for character strings).
3199+
</para>
31913200
</sect1>
31923201

31933202
<sect1 id="datatype-xml">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp