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

53.11. pg_class #

The catalog <structname>pg_class</structname> catalogs tables and most everything else that has columns or is otherwise similar to a table. This includes indexes (but see also <link linkend="catalog-pg-index"><structname>pg_index</structname></link>), sequences (but see also <link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link>), views, materialized views, composite types, and TOAST tables; see <structfield>relkind</structfield>. Below, when we mean all of these kinds of objects we speak of <quote>relations</quote>. Not all columns are meaningful for all relation types. pg_classカタログはテーブルと、その他に列を持つもの、あるいはテーブルに似た全てのものを目録にしています。 その中にはインデックス(pg_indexも参照)、シーケンス(pg_sequenceも参照)、ビュー、マテリアライズドビュー、複合型およびTOASTテーブルが含まれます。 relkindを参照してください。 これより以降、リレーションと記されている場合はこれらすべてのオブジェクトを意味しています。 すべての列が全てのリレーションの型に該当するとは限りません。

表53.11 pg_classの列

<title><structname>pg_class</structname> Columns</title>

Column Type 列 型

Description 説明

oid oid

Row identifier 行識別子

relname name

Name of the table, index, view, etc. テーブル、インデックス、ビューなどの名前

relnamespace oid (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>) (参照先 pg_namespace.oid

The OID of the namespace that contains this relation このリレーションを持つ名前空間のOID

reltype oid (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>) (参照先 pg_type.oid

The OID of the data type that corresponds to this table's row type, if any; zero for indexes, sequences, and toast tables, which have no <structname>pg_type</structname> entry このテーブルの行の型に対応するデータ型のOID。ゼロならば、pg_typeエントリを持たないインデックス、シーケンス、TOASTテーブル。

reloftype oid (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>) (参照先 pg_type.oid

For typed tables, the OID of the underlying composite type; zero for all other relations 型付けされたテーブルでは背後にある複合型のOID。 その他のリレーションではゼロ

relowner oid (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>) (参照先 pg_authid.oid

Owner of the relation リレーションの所有者

relam oid (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>) (参照先 pg_am.oid

If this is a table or an index, the access method used (heap, B-tree, hash, etc.); otherwise zero (zero occurs for sequences, as well as relations without storage, such as views) これがテーブルあるいはインデックスの場合は、それに使われている(ヒープ、B-tree、ハッシュなどの)アクセスメソッド。 そうでなければ、ゼロ(シーケンスおよびビューのように格納場所を持たないリレーションではゼロになります)。

relfilenode oid

Name of the on-disk file of this relation; zero means this is a <quote>mapped</quote> relation whose disk file name is determined by low-level state このリレーションのディスク上のファイルの名前です。 ゼロはディスク上のファイル名が低レベルな状態で決定されるマップ付けされたリレーションであることを意味します。

reltablespace oid (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>oid</structfield>) (参照先 pg_tablespace.oid

The tablespace in which this relation is stored. If zero, the database's default tablespace is implied. (Not meaningful if the relation has no on-disk file.) このリレーションが保存されているテーブル空間。 もしゼロならば、このデータベースのデフォルトテーブル空間を意味します。 (リレーションがディスク上のファイルになくても、問題はありません。)

relpages int4

Size of the on-disk representation of this table in pages (of size <symbol>BLCKSZ</symbol>). This is only an estimate used by the planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>, <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as <link linkend="sql-createindex"><command>CREATE INDEX</command></link>. このテーブルのディスク上表現のページ単位(BLCKSZ)のサイズ。 これはプランナで使用される単なる推測値です。 VACUUMANALYZEおよびCREATE INDEXコマンドなどの一部のDDLコマンドで更新されます。

reltuples float4

Number of live rows in the table. This is only an estimate used by the planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>, <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as <link linkend="sql-createindex"><command>CREATE INDEX</command></link>. If the table has never yet been vacuumed or analyzed, <structfield>reltuples</structfield> contains <literal>-1</literal> indicating that the row count is unknown. テーブル内の生きている行数。 これはプランナで使用される単なる推測値です。 VACUUMANALYZECREATE INDEXなどの一部のDDLコマンドで更新されます。 テーブルにまだVACUUMやANALYZEが行われていなければ、reltuplesには行数が未知であることを示す-1が入ります。

relallvisible int4

Number of pages that are marked all-visible in the table's visibility map. This is only an estimate used by the planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>, <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as <link linkend="sql-createindex"><command>CREATE INDEX</command></link>. テーブル内の可視マップ内で全て可視とマークされているページ数。 これはプランナで使用される単なる見積です。 VACUUMANALYZECREATE INDEXなどの一部のDDLコマンドで更新されます。

reltoastrelid oid (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>) (参照先 pg_class.oid

OID of the TOAST table associated with this table, zero if none. The TOAST table stores large attributes <quote>out of line</quote> in a secondary table. このテーブルに関連しているTOASTテーブルのOID。 何もない場合はゼロ。 TOASTテーブルは行に収まらない大きい属性を副テーブルに格納します。

relhasindex bool

True if this is a table and it has (or recently had) any indexes テーブルであり、かつ、インデックスを持つ(あるいはつい最近まで持っていた)場合はtrue

relisshared bool

True if this table is shared across all databases in the cluster. Only certain system catalogs (such as <link linkend="catalog-pg-database"><structname>pg_database</structname></link>) are shared. クラスタ内の全てのデータベースにわたってこのテーブルが共有されている場合はtrue。 (pg_databaseのような)ある特定のシステムカタログのみ共有されます。

relpersistence char

<literal>p</literal> = permanent table/sequence, <literal>u</literal> = unlogged table/sequence, <literal>t</literal> = temporary table/sequence p = 永続テーブル/シーケンス、 u = ログを取らないテーブル/シーケンス、 t = 一時テーブル/シーケンス

relkind char

<literal>r</literal> = ordinary table, <literal>i</literal> = index, <literal>S</literal> = sequence, <literal>t</literal> = TOAST table, <literal>v</literal> = view, <literal>m</literal> = materialized view, <literal>c</literal> = composite type, <literal>f</literal> = foreign table, <literal>p</literal> = partitioned table, <literal>I</literal> = partitioned index r = 通常のテーブル、 i = インデックス、 S = シーケンス、 t = TOASTテーブル、 v = ビュー、 m = マテリアライズドビュー、 c = 複合型、 f = 外部テーブル、 p = パーティションテーブル、 I = パーティションインデックス

relnatts int2

Number of user columns in the relation (system columns not counted). There must be this many corresponding entries in <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>. See also <structname>pg_attribute</structname>.<structfield>attnum</structfield>. リレーションにあるユーザ列数(システム列は含みません)。 pg_attributeにこれに対応する数多くの項目があるはずです。 pg_attribute.attnumも参照してください。

relchecks int2

Number of <literal>CHECK</literal> constraints on the table; see <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog テーブル上のCHECK制約の数。 pg_constraintカタログを参照してください

relhasrules bool

True if table has (or once had) rules; see <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog テーブルにルールがある(あるいは以前あった)場合はtrue。 pg_rewriteカタログを参照してください

relhastriggers bool

True if table has (or once had) triggers; see <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog テーブルにトリガがある(あるいは以前あった)場合はtrue。 pg_triggerカタログを参照してください

relhassubclass bool

True if table or index has (or once had) any inheritance children or partitions テーブルあるいはインデックスが子テーブルあるいはパーティションに継承されている(または以前に継承されていた)場合はtrue

relrowsecurity bool

True if table has row-level security enabled; see <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog 行単位セキュリティが有効なテーブルの場合はtrue。 pg_policyカタログを参照してください

relforcerowsecurity bool

True if row-level security (when enabled) will also apply to table owner; see <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog 行単位セキュリティが(有効にされているとして)テーブルの所有者にも適用される場合はtrue。 pg_policyカタログを参照してください

relispopulated bool

True if relation is populated (this is true for all relations other than some materialized views) リレーションにデータが投入されている場合はtrue(マテリアライズドビュー以外のすべてのリレーションではtrueです)

relreplident char

Columns used to form <quote>replica identity</quote> for rows: <literal>d</literal> = default (primary key, if any), <literal>n</literal> = nothing, <literal>f</literal> = all columns, <literal>i</literal> = index with <structfield>indisreplident</structfield> set (same as nothing if the index used has been dropped) 行にreplica identityフォームを使った列: d = デフォルト(もしあれば主キー)、 n = 無し、 f = 全ての列、 i = インデックスと indisreplidentのセット(使用されていたインデックスが削除されていた場合は、無し、と同様)

relispartition bool

True if table or index is a partition テーブルあるいはインデックスがパーティションである場合はtrue

relrewrite oid (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>) (参照先 pg_class.oid

For new relations being written during a DDL operation that requires a table rewrite, this contains the OID of the original relation; otherwise zero. That state is only visible internally; this field should never contain anything other than zero for a user-visible relation. テーブルの書き換えが必要なDDL操作中に書き込みが行われる新しいリレーションでは、これは元のリレーションのOIDを持ちます。 そうでなければゼロです。 この状態は内部的にのみ可視です。 このフィールドはユーザから見えるリレーションではゼロ以外を持つべきではありません。

relfrozenxid xid

All transaction IDs before this one have been replaced with a permanent (<quote>frozen</quote>) transaction ID in this table. This is used to track whether the table needs to be vacuumed in order to prevent transaction ID wraparound or to allow <literal>pg_xact</literal> to be shrunk. Zero (<symbol>InvalidTransactionId</symbol>) if the relation is not a table. この値より以前のトランザクションIDはすべて、このテーブルで永続的な(凍結された)トランザクションIDに置き換えられています。 これは、このテーブルに対して、トランザクションID周回を防ぎ、かつ、pg_xactを縮小させることを目的としたバキュームを行うかどうかを追跡するために使用されます。 リレーションがテーブルではない場合はゼロ(InvalidTransactionId)です。

relminmxid xid

All multixact IDs before this one have been replaced by a transaction ID in this table. This is used to track whether the table needs to be vacuumed in order to prevent multixact ID wraparound or to allow <literal>pg_multixact</literal> to be shrunk. Zero (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table. このテーブル内のトランザクションIDによって置換される前のすべてのマルチトランザクションID。 これは、マルチトランザクションIDのID周回を防ぐ、またはpg_multixactを縮小させるために、テーブルをバキュームする必要があるかどうかを追跡するために使用されます。 リレーションがテーブルではない場合はゼロ(InvalidMultiXactId)です。

relacl aclitem[]

Access privileges; see <xref linkend="ddl-priv"/> for details アクセス権限。 詳細は5.7を参照してください

reloptions text[]

Access-method-specific options, as <quote>keyword=value</quote> strings keyword=value文字列のような、アクセスメソッド特有のオプション

relpartbound pg_node_tree

If table is a partition (see <structfield>relispartition</structfield>), internal representation of the partition bound テーブルがパーティションの場合(relispartition参照)のパーティション境界の内部表現


Several of the Boolean flags in <structname>pg_class</structname> are maintained lazily: they are guaranteed to be true if that's the correct state, but may not be reset to false immediately when the condition is no longer true. For example, <structfield>relhasindex</structfield> is set by <link linkend="sql-createindex"><command>CREATE INDEX</command></link>, but it is never cleared by <link linkend="sql-dropindex"><command>DROP INDEX</command></link>. Instead, <link linkend="sql-vacuum"><command>VACUUM</command></link> clears <structfield>relhasindex</structfield> if it finds the table has no indexes. This arrangement avoids race conditions and improves concurrency. pg_class内の複数の論理型フラグは、ゆっくりと保守されます。 正しい状態にあるときにtrueであることが保証されていますが、その条件がtrueでなくなった時即座にfalseに再設定されないかもしれません。 例えばrelhasindexCREATE INDEXで設定されますが、DROP INDEXでは決して初期化されません。 代わりにVACUUMがそのテーブルにインデックスがないことを判定した場合にrelhasindexを初期化します。 この調整により競合状態を防止し、同時実行性が向上します。