バージョンごとのドキュメント一覧

付録K PostgreSQLの制限

<title><productname>PostgreSQL</productname> Limits</title>

<xref linkend="limits-table"/> describes various hard limits of <productname>PostgreSQL</productname>. However, practical limits, such as performance limitations or available disk space may apply before absolute hard limits are reached. 表 K.1PostgreSQLの様々なハード制限を示します。 しかしながら、絶対的なハード制限に達する前に、パフォーマンスの制限や利用可能なディスク容量などの実際の制限が適用されるかもしれません。

表K.1 PostgreSQLの制限

<title><productname>PostgreSQL</productname> Limitations</title>
項目上限コメント
データベースの大きさ無制限 
データベースの数4,294,950,911 
データベース当たりのリレーション1,431,650,303 
リレーションの大きさ32 TBBLCKSZがデフォルトの8192バイトの場合。
テーブル当たりの行4,294,967,295ページに収まるタプルの数により制限されます。 
テーブル当たりの列16001ページに収まるタプルの大きさによりさらに制限されます。以下の注意書きを参照してください。
結果集合内の列1664 
フィールドの大きさ1 GB 
識別子の長さ63バイトPostgreSQLを再コンパイルすることで増やせます。
テーブル当たりのインデックス無制限データベース当たりの最大リレーションで制限されます。
インデックス当たりの列32PostgreSQLを再コンパイルすることで増やせます。
パーティションキー32PostgreSQLを再コンパイルすることで増やせます。

The maximum number of columns for a table is further reduced as the tuple being stored must fit in a single 8192-byte heap page. For example, excluding the tuple header, a tuple made up of 1600 <type>int</type> columns would consume 6400 bytes and could be stored in a heap page, but a tuple of 1600 <type>bigint</type> columns would consume 12800 bytes and would therefore not fit inside a heap page. Variable-length fields of types such as <type>text</type>, <type>varchar</type>, and <type>char</type> can have their values stored out of line in the table's TOAST table when the values are large enough to require it. Only an 18-byte pointer must remain inside the tuple in the table's heap. For shorter length variable-length fields, either a 4-byte or 1-byte field header is used and the value is stored inside the heap tuple. 格納されるタプルが8192バイトの1つのヒープページに収まらないといけませんので、テーブル当たりの列の最大数はさらに少なくなります。 例えば、タプルヘッダを除いて、1600のintの列は6400バイトを消費しますのでヒープページ1つに収まりますが、1600のbigintの列は12800バイトを消費しますのでヒープページ1つの中には収まりません。 textvarcharcharのような可変長の型のフィールドは、その必要があるほど値が長くなれば、行に収まらないその値をテーブルのTOASTテーブルに格納します。 18バイトのポインタだけがテーブルのヒープのタプル内に残ります。 より短い長さの可変長フィールドでは、4バイトまたは1バイトのフィールドヘッダが使われ、値はヒープタプルの中に格納されます。

Columns that have been dropped from the table also contribute to the maximum column limit. Moreover, although the dropped column values for newly created tuples are internally marked as null in the tuple's null bitmap, the null bitmap also occupies space. テーブルから削除された列も列の上限の一因となります。 さらに、新しく作られたタプルに対する削除された列の値は、内部ではタプルのNULLビットマップにNULLと印を付けられますが、NULLビットマップも容量を占めます。