pg_opclass — PostgreSQL system catalog

The PostgreSQL pg_opclass system catalog: full column reference (names, types, descriptions), catalog relationships and version support.

Summary

The catalog pg_opclass defines index access method operator classes. Each operator class defines semantics for index columns of a particular data type and a particular index access method. An operator class essentially specifies that a particular operator family is applicable to a particular indexable column data type. The set of operators from the family that are actually usable with the indexed column are whichever ones accept the column’s data type as their left-hand input.

(Description quoted from the official PostgreSQL documentation.)

Columns

The pg_opclass system catalog exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):

  • oid oid
    Row identifier
  • opcmethod oid references pg_am.oid
    Index access method operator class is for
  • opcname name
    Name of this operator class
  • opcnamespace oid references pg_namespace.oid
    Namespace of this operator class
  • opcowner oid references pg_authid.oid
    Owner of the operator class
  • opcfamily oid references pg_opfamily.oid
    Operator family containing the operator class
  • opcintype oid references pg_type.oid
    Data type that the operator class indexes
  • opcdefault bool
    True if this operator class is the default for opcintype
  • opckeytype oid references pg_type.oid
    Type of data stored in index, or zero if same as opcintype

Related catalogs

This object references the following other system catalogs:

Version applicability

Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.

Related & references

Reference: PostgreSQL documentation — pg_opclass.