Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6812042

Browse files
committed
doc: Add appendix detailing some limits of PostgreSQL
This used to be on the web site but was removed. The documentation is a better place for it anyway. Author: David Rowley <david.rowley@2ndquadrant.com> Reviewed-by: John Naylor <jcnaylor@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CAKJS1f_dKdejdKB94nKZC9S5NzB-UZRcAKkE84e=JEEecDuotg@mail.gmail.com/
1 parent 44e2264 commit 6812042

File tree

3 files changed

+122
-0
lines changed

3 files changed

+122
-0
lines changed

doc/src/sgml/filelist.sgml

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
<!ENTITY release-7.4 SYSTEM "release-7.4.sgml">
184184
<!ENTITY release-old SYSTEM "release-old.sgml">
185185

186+
<!ENTITY limits SYSTEM "limits.sgml">
186187
<!ENTITY acronyms SYSTEM "acronyms.sgml">
187188

188189
<!ENTITY features-supported SYSTEM "features-supported.sgml">

doc/src/sgml/limits.sgml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<!-- doc/src/sgml/limits.sgml -->
2+
3+
<appendix id="limits">
4+
<title><productname>PostgreSQL</productname> Limits</title>
5+
6+
<para>
7+
<xref linkend="limits-table"/> describes various hard limits of
8+
<productname>PostgreSQL</productname>. However, practical limits, such as
9+
performance limitations or available disk space may apply before absolute
10+
hard limits are reached.
11+
</para>
12+
13+
<table id="limits-table">
14+
<title><productname>PostgreSQL</productname> limitations</title>
15+
<tgroup cols="3">
16+
<thead>
17+
<row>
18+
<entry>Item</entry>
19+
<entry>Upper Limit</entry>
20+
<entry>Comment</entry>
21+
</row>
22+
</thead>
23+
24+
<tbody>
25+
<row>
26+
<entry>database size</entry>
27+
<entry>unlimited</entry>
28+
<entry></entry>
29+
</row>
30+
31+
<row>
32+
<entry>number of databases</entry>
33+
<!-- 2^32 - FirstNormalObjectId - 1 -->
34+
<entry>4,294,950,911</entry>
35+
<entry></entry>
36+
</row>
37+
38+
<row>
39+
<entry>relations per database</entry>
40+
<!-- (2^32 - FirstNormalObjectId - 1) / 3 (3 because of the table and the
41+
two types that are created to go with it) -->
42+
<entry>1,431,650,303</entry>
43+
<entry></entry>
44+
</row>
45+
46+
<row>
47+
<entry>relation size</entry>
48+
<entry>32 TB</entry>
49+
<entry>with the default <symbol>BLCKSZ</symbol> of 8192 bytes</entry>
50+
</row>
51+
52+
<row>
53+
<entry>rows per table</entry>
54+
<entry>limited by the number of tuples that can fit onto 4,294,967,295 pages</entry>
55+
<entry></entry>
56+
</row>
57+
58+
<row>
59+
<entry>columns per table</entry>
60+
<entry>1600</entry>
61+
<entry>further limited by tuple size fitting on a single page; see note
62+
below</entry>
63+
</row>
64+
65+
<row>
66+
<entry>field size</entry>
67+
<entry>1 GB</entry>
68+
<entry></entry>
69+
</row>
70+
71+
<row>
72+
<entry>identifier length</entry>
73+
<entry>63 bytes</entry>
74+
<entry>can be increased by recompiling <productname>PostgreSQL</productname></entry>
75+
</row>
76+
77+
<row>
78+
<entry>indexes per table</entry>
79+
<entry>unlimited</entry>
80+
<entry>constrained by maximum relations per database</entry>
81+
</row>
82+
83+
<row>
84+
<entry>columns per index</entry>
85+
<entry>32</entry>
86+
<entry>can be increased by recompiling <productname>PostgreSQL</productname></entry>
87+
</row>
88+
89+
<row>
90+
<entry>partition keys</entry>
91+
<entry>32</entry>
92+
<entry>can be increased by recompiling <productname>PostgreSQL</productname></entry>
93+
</row>
94+
</tbody>
95+
</tgroup>
96+
</table>
97+
98+
<para>
99+
The maximum number of columns for a table is further reduced as the tuple
100+
being stored must fit in a single 8192-byte heap page. For example,
101+
excluding the tuple header, a tuple made up of 1600 <type>int</type> columns
102+
would consume 6400 bytes and could be stored in a heap page, but a tuple of
103+
1600 <type>bigint</type> columns would consume 12800 bytes and would
104+
therefore not fit inside a heap page.
105+
Variable-length fields of
106+
types such as <type>text</type>, <type>varchar</type>, and <type>char</type>
107+
can have their values stored out of line in the table's TOAST table when the
108+
values are large enough to require it. Only an 18-byte pointer must remain
109+
inside the tuple in the table's heap. For shorter length variable-length
110+
fields, either a 4-byte or 1-byte field header is used and the value is
111+
stored inside the heap tuple.
112+
</para>
113+
114+
<para>
115+
Columns that have been dropped from the table also contribute to the maximum
116+
column limit. Moreover, although the dropped column values for newly
117+
created tuples are internally marked as null in the tuple's null bitmap, the
118+
null bitmap also occupies space.
119+
</para>
120+
</appendix>

doc/src/sgml/postgres.sgml

+1
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
&external-projects;
276276
&sourcerepo;
277277
&docguide;
278+
&limits;
278279
&acronyms;
279280

280281
</part>

0 commit comments

Comments
 (0)