From 2ea151e1bfc042c372b3d4a8d1eef07ffd15de45 Mon Sep 17 00:00:00 2001
From: "dgrowley@gmail.com" <dgrowley@gmail.com>
Date: Wed, 31 Oct 2018 01:45:41 +1300
Subject: [PATCH v2] Add documentation section appendix detailing some
 limitations of PostgreSQL

---
 doc/src/sgml/dblimits.sgml | 107 +++++++++++++++++++++++++++++++++++++++++++++
 doc/src/sgml/filelist.sgml |   1 +
 doc/src/sgml/postgres.sgml |   1 +
 3 files changed, 109 insertions(+)
 create mode 100644 doc/src/sgml/dblimits.sgml

diff --git a/doc/src/sgml/dblimits.sgml b/doc/src/sgml/dblimits.sgml
new file mode 100644
index 0000000000..7c58a2edea
--- /dev/null
+++ b/doc/src/sgml/dblimits.sgml
@@ -0,0 +1,107 @@
+<!-- doc/src/sgml/dblimits.sgml -->
+
+<appendix id="dblimits">
+ <title>Database Limitations</title>
+
+ <para>
+ The following table describes the limits of <productname>PostgreSQL</productname>
+ </para>
+
+<table id="dblimits-table">
+ <title><productname>PostgreSQL</productname> limitations</title>
+ <tgroup cols="3">
+  <thead>
+   <row>
+    <entry>Item</entry>
+    <entry>Limit</entry>
+    <entry>Comment</entry>
+   </row>
+  </thead>
+
+  <tbody>
+     <row>
+      <entry>Maximum Database Size</entry>
+      <entry>Unlimited</entry>
+      <entry></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Number of Databases</entry>
+      <entry>Unlimited</entry>
+      <entry></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Relation Size</entry>
+      <entry>32 TB</entry>
+      <entry>Limited to 2^32 - 1 pages per relation. Can be increased by
+      increasing <literal>BLCKSZ</literal> and recompiling
+      <productname>PostgreSQL</productname></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Columns per Table</entry>
+      <entry>250 - 1600</entry>
+      <entry>Depending on column types. (More details here)</entry>
+     </row>
+
+     <row>
+      <entry>Maximum Row Size</entry>
+      <entry>1600 GB</entry>
+      <entry>Assuming 1600 columns, each 1 GB in size</entry>
+     </row>
+
+     <row>
+      <entry>Maximum Field Size</entry>
+      <entry>1 GB</entry>
+      <entry></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Identifier Length</entry>
+      <entry>63 characters</entry>
+      <entry>Can be increased by recompiling <productname>PostgreSQL</productname></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Rows per Table</entry>
+      <entry>Unlimited</entry>
+      <entry></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Indexes per Table</entry>
+      <entry>Unlimited</entry>
+      <entry></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Indexed Columns</entry>
+      <entry>32</entry>
+      <entry>Can be increased by recompiling <productname>PostgreSQL</productname>. Limit includes
+      any <literal>INCLUDE</literal> columns</entry>
+     </row>
+
+     <row>
+      <entry>Maximum Partition Keys</entry>
+      <entry>32</entry>
+      <entry>Can be increased by recompiling <productname>PostgreSQL</productname></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Relations per Database</entry>
+      <entry>Unlimited</entry>
+      <entry></entry>
+     </row>
+
+     <row>
+      <entry>Maximum Partitions per Partitioned Relations</entry>
+      <entry>268,435,456</entry> <!-- limited by 1GB palloc limit for oids field in PartitionDesc -->
+      <entry>May be increased by using sub-partitioning</entry>
+     </row>
+     
+  </tbody>
+ </tgroup>
+</table>
+
+</appendix>
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index 48ac14a838..be8d3d6800 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -185,6 +185,7 @@
 <!ENTITY release-old    SYSTEM "release-old.sgml">
 
 <!ENTITY acronyms   SYSTEM "acronyms.sgml">
+<!ENTITY dblimits   SYSTEM "dblimits.sgml">
 
 <!ENTITY features-supported   SYSTEM "features-supported.sgml">
 <!ENTITY features-unsupported SYSTEM "features-unsupported.sgml">
diff --git a/doc/src/sgml/postgres.sgml b/doc/src/sgml/postgres.sgml
index 0070603fc3..369eca61cf 100644
--- a/doc/src/sgml/postgres.sgml
+++ b/doc/src/sgml/postgres.sgml
@@ -268,6 +268,7 @@
   <title>Appendixes</title>
 
   &errcodes;
+  &dblimits;
   &datetime;
   &keywords;
   &features;
-- 
2.16.2.windows.1

