pg_index

The pg_index catalog provides information about indexes.

Column name Data type Description
indexrelid oid (references pg_class.oid) The OID of the pg_class entry for this index.
indrelid oid (references pg_class.oid) The OID of the pg_class entry for the table to which the index belongs.
indnatts int2 The total number of columns in the index, including both the key and assigned attributes.Note: indnatts stores the same count number that appears in pg_class.relnatts for the index relation.
indnkeyatts int2 The number of key columns in the index, excluding any columns that do not participate in index semantics.
indisunique bool Specifies whether this is a unique index (TRUE) or not (FALSE).
indnullsnotdistinct bool Specifies whether NULL values are considered distinct (FALSE) or equal (TRUE).
indisprimary bool Specifies whether the index represents the table’s primary key (TRUE) or not (FALSE).
Note: indisunique is always TRUE when indisprimary is TRUE.
indisexclusion bool Specifies whether the index supports an exclusion constraint (TRUE) or not (FALSE).
indimmediate bool Specifies whether uniqueness checks are enforced immediately on insertion (TRUE) or not (FALSE).
Note: If indisunique is FALSE, this option doesn’t apply.
indisclustered bool Specifies whether the table was last clustered on the index (TRUE) or not (FALSE).
indisvalid bool Specifies whether the index is valid for queries (TRUE) or not (FALSE).
Note: FALSE indicates the index may be incomplete and cannot safely be used.
indcheckxmin bool Specifies whether queries must avoid using this index until the xmin of the pg_index row is below their TransactionXmin (TRUE) or not (FALSE).
indisready bool Specifies whether the index is ready for inserts (TRUE) or not (FALSE).
indislive bool Specifies whether the index is live (TRUE) or in the process of being dropped (FALSE).
indisreplident bool Specifies whether this index has been chosen as the “replica identity” (TRUE) or not (FALSE).
indkey int2vector (references pg_attribute.attnum) The array of indnatts values indicating which table columns are indexed. Key columns come before included columns.
0 indicates an expression instead of a simple column.
indcollation oidvector (references pg_collation.oid) The OID of the collation to use for each key column.
The value is 0 if the column type is not collatable.
indclass oidvector (references pg_opclass.oid) The OID of the operator class used for each column.
indoption int2vector The array of per-column flag bits for key columns.
indexprs pg_node_tree Expression trees (in nodeToString() representation) for index attributes that are expressions (where indkey is 0).
The value is NULL if all attributes are simple columns.
indpred pg_node_tree An expression tree (in nodeToString() representation) for a partial index predicate.
The value is NULL if it is not a partial index.