pg_class
The system catalog table pg_class catalogs tables and most everything else that has columns or is otherwise similar to a table (also known as relations).
This includes indexes (see also pg_index), sequences, views, composite types, and TOAST tables.
Not all columns are meaningful for all relation types.
| Column | Type | References | Description |
|---|---|---|---|
relname |
name |
— |
Name of the table, index, view, and so on |
relnamespace |
oid |
pg_namespace.oid |
The OID of the namespace (schema) that contains this relation |
reltype |
oid |
pg_type.oid |
The OID of the data type that corresponds to this table’s row type, if any ( |
reloftype |
oid |
pg_type.oid |
The OID of an entry in pg_type for an underlying composite type |
relowner |
oid |
pg_authid.oid |
Owner of the relation |
relam |
oid |
pg_am.oid |
If this is an index, the access method used (B-tree, Bitmap, GIN, and so on) |
relfilenode |
oid |
— |
Name of the on-disk file of this relation; |
reltablespace |
oid |
pg_tablespace.oid |
The tablespace in which this relation is stored.
If |
relpages |
integer |
— |
Size of the on-disk representation of this table in pages.
This is only an estimate used by the planner.
It is updated by |
reltuples |
float4 |
— |
Number of rows in the table.
This is only an estimate used by the planner.
It is updated by |
relallvisible |
int32 |
— |
Number of all-visible blocks (this value may not be up to date) |
reltoastrelid |
oid |
pg_class.oid |
OID of the TOAST table associated with this table, |
relhasindex |
boolean |
— |
|
relisshared |
boolean |
— |
|
relpersistence |
char |
— |
The type of object persistence:
|
relkind |
char |
— |
The type of object:
|
relstorage |
char |
— |
The storage mode of a table:
|
relnatts |
int2 |
— |
Number of user columns in the relation (system columns not counted).
There must be this many corresponding entries in |
relchecks |
int2 |
— |
Number of check constraints on the table |
relhasoids |
boolean |
— |
|
relhaspkey |
boolean |
— |
|
relhasrules |
boolean |
— |
|
relhastriggers |
boolean |
— |
|
relhassubclass |
boolean |
— |
|
relispopulated |
boolean |
— |
|
relreplident |
char |
— |
Columns used to form "replica identity" for rows:
|
relfrozenxid |
xid |
— |
All transaction IDs before this one have been replaced with a permanent (frozen) 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 The value is |
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 |
relacl |
aclitem[] |
— |
Access privileges assigned by |
reloptions |
text[] |
— |
Access-method-specific options, as |