Updated on 2024-06-03 GMT+08:00

PG_INDEX

PG_INDEX records part of index information. The rest is mostly recorded in PG_CLASS.

Table 1 PG_INDEX columns

Name

Type

Description

indexrelid

oid

OID of the PG_CLASS entry for the index.

indrelid

oid

OID of the PG_CLASS entry for the table that uses the index.

indnatts

smallint

Number of columns in the index.

indisunique

Boolean

Specifies whether the index is unique.

  • true: The index is unique.
  • false: The index is not unique.

indisprimary

Boolean

Specifies whether the index is the primary key of the table.

  • true: The index is the primary key of the table. indisunique should always be true when the value of this column is true.
  • false: The index is not the primary key of the table.

indisexclusion

Boolean

Specifies whether the index supports exclusive constraints.

  • true: The index supports exclusive constraints.
  • false: The index does not support exclusive constraints.

indimmediate

Boolean

Specifies whether to check the uniqueness of data to be inserted.

  • true: The uniqueness check is performed immediately when data is inserted.
  • false: The uniqueness check is not performed when data is inserted.

indisclustered

Boolean

Specifies whether the table is clustered on the index.

  • true: The table is clustered on the index.
  • false: The table is not clustered on the index.

indisusable

Boolean

Specifies whether the index is available for insert and select operations.

  • true: The index is available for insert and select operations.
  • false: The index is unavailable for insert and select operations.

indisvalid

Boolean

  • true: The index can be used for query.
  • false: The index is possibly incomplete and must still be modified by INSERT or UPDATE operations, but it cannot be securely used for queries. If it is a unique index, the uniqueness property is also not true.

indcheckxmin

Boolean

  • true: Queries must not use the index until the xmin of this row in PG_INDEX is lower than their TransactionXmin, because the table may contain broken HOT chains with incompatible rows that they can see.
  • false: Indexes can be used for query.

indisready

Boolean

  • true: The index is available for inserting data.
  • false: The index is ignored when data is inserted or modified.

indkey

int2vector

This is an array of indnatts values indicating that this index creates table columns. For example, a value of 1 3 indicates that the first and the third columns make up the index key. The value 0 in this array indicates that the corresponding index attribute is an expression over the table columns, rather than a simple column reference.

indcollation

oidvector

OID of the collation corresponding to each index column. For details, see PG_COLLATION.

indclass

oidvector

For each column in the index key, this contains the OID of the operator class to use. For details, see section 12.2.15.53 PG_OPCLASS.

indoption

int2vector

Array of values that store per-column flag bits. The meaning of the bits is defined by the index's access method.

indexprs

pg_node_tree

Expression trees (in nodeToString() representation) for index attributes that are not simple column references. It is a list with one element for each zero entry in indkey. The value is null if all index attributes are simple references.

indpred

pg_node_tree

Expression tree (in nodeToString() representation) for partial index predicate. If the index is not a partial index, this column is an empty string.

indisreplident

Boolean

Specifies whether the column of this index is a decoded column of logical decoding.

  • true: The column of this index is a decoded column of logical decoding.
  • false: The column of this index is not a decoded column of logical decoding.

indnkeyatts

smallint

Total number of columns in the index. The columns that exceed the value of indnatts are not involved in the index query.

indcctmpid

oid

OID of the temporary table when the Ustore builds indexes online.

indisvisible

Boolean

  • true: The index status is visible, that is, the optimizer can use the index.
  • false: The index is invisible. If the value of enable_invisible_indexes is off, the optimizer cannot use the index. If the value of enable_invisible_indexes is on, the optimizer can use the index.