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

5.5. システム列 #

<title>System Columns</title>

Every table has several <firstterm>system columns</firstterm> that are implicitly defined by the system. Therefore, these names cannot be used as names of user-defined columns. (Note that these restrictions are separate from whether the name is a key word or not; quoting a name will not allow you to escape these restrictions.) You do not really need to be concerned about these columns; just know they exist. 全てのテーブルには、システムによって暗黙的に定義されたシステム列がいくつかあります。 そのため、システム列の名前はユーザ定義列の名前として使うことはできません。 (これらの制約は名前がキーワードであるかどうかとは関係ありません。 つまり、名前を引用符で囲んでもこの制約を回避することはできません。) システム列については、あまり意識する必要はありません。 これらが存在することを知っていれば十分です。

tableoid #

The OID of the table containing this row. This column is particularly handy for queries that select from partitioned tables (see <xref linkend="ddl-partitioning"/>) or inheritance hierarchies (see <xref linkend="ddl-inherit"/>), since without it, it's difficult to tell which individual table a row came from. The <structfield>tableoid</structfield> can be joined against the <structfield>oid</structfield> column of <structname>pg_class</structname> to obtain the table name. この行を含むテーブルのOIDです。 この列は特に、パーティション化テーブルからの問い合わせで(5.11を参照してください)、あるいは継承階層からの問い合わせでは便利です(5.10を参照してください)。 この列がないと、どのテーブルからその行が来たのかわかりにくいからです。 tableoidpg_classoid列に結合することでテーブル名を得ることができます。

xmin #

The identity (transaction ID) of the inserting transaction for this row version. (A row version is an individual state of a row; each update of a row creates a new row version for the same logical row.) この行バージョンの挿入トランザクションの識別情報(トランザクションID)です。 (行バージョンとは、行の個別の状態です。 行が更新される度に、同一の論理的な行に対する新しい行バージョンが作成されます。)

cmin #

The command identifier (starting at zero) within the inserting transaction. 挿入トランザクション内の(0から始まる)コマンド識別子です。

xmax #

The identity (transaction ID) of the deleting transaction, or zero for an undeleted row version. It is possible for this column to be nonzero in a visible row version. That usually indicates that the deleting transaction hasn't committed yet, or that an attempted deletion was rolled back. 削除トランザクションの識別情報(トランザクションID)です。 削除されていない行バージョンではゼロです。 可視の行バージョンでこの列が非ゼロの場合があります。 これは通常、削除トランザクションがまだコミットされていないこと、または、削除の試行がロールバックされたことを意味しています。

cmax #

The command identifier within the deleting transaction, or zero. 削除トランザクション内のコマンド識別子、もしくはゼロです。

ctid #

The physical location of the row version within its table. Note that although the <structfield>ctid</structfield> can be used to locate the row version very quickly, a row's <structfield>ctid</structfield> will change if it is updated or moved by <command>VACUUM FULL</command>. Therefore <structfield>ctid</structfield> is useless as a long-term row identifier. A primary key should be used to identify logical rows. テーブル内における、行バージョンの物理的位置を表します。 ctidは行バージョンを素早く見つけるために使うことができますが、行のctidは、行がUPDATEされる、あるいはVACUUM FULLで行が移動されると変わります。 したがって、ctidは長期の行識別子としては使えません。 論理行を識別するためには、主キーを使うべきです。

Transaction identifiers are also 32-bit quantities. In a long-lived database it is possible for transaction IDs to wrap around. This is not a fatal problem given appropriate maintenance procedures; see <xref linkend="maintenance"/> for details. It is unwise, however, to depend on the uniqueness of transaction IDs over the long term (more than one billion transactions). トランザクション識別子も32ビット量です。 長期間使用するデータベースでは、トランザクションIDが一周してしまう可能性があります。 これは、適切な保守作業を行うことで、致命的な問題にはなりません。 詳細は第25章を参照してください。 しかし、長期(10億トランザクション以上)にわたってトランザクションIDの一意性に依存することは賢明ではありません。

Command identifiers are also 32-bit quantities. This creates a hard limit of 2<superscript>32</superscript> (4 billion) <acronym>SQL</acronym> commands within a single transaction. In practice this limit is not a problem &mdash; note that the limit is on the number of <acronym>SQL</acronym> commands, not the number of rows processed. Also, only commands that actually modify the database contents will consume a command identifier. コマンド識別子もまた、32ビット量です。 このため、単一トランザクション内のコマンド数には232(40億)個までというSQLコマンドのハード制限が発生します。 実際、この制限は問題になりません。 これはSQLコマンド数に対する制限であり、処理される行数に対する制限ではないことに注意してください。 また、データベースの内容を実際に変更するコマンドのみがコマンド識別子を消費します。