September 26, 2024: PostgreSQL 17 Released!
Supported Versions: Current (17) / 16 / 15 / 14 / 13 / 12
Development Versions: devel
Unsupported versions: 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

42.24. pg_opclass

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. Note that there can be multiple operator classes for a given data type/access method combination, thus supporting multiple behaviors.

Operator classes are described at length in Section 32.14.

Table 42-24. pg_opclass Columns

Name Type References Description
opcamid oid pg_am.oid Index access method operator class is for
opcname name   Name of this operator class
opcnamespace oid pg_namespace.oid Namespace of this operator class
opcowner oid pg_authid.oid Owner of the operator class
opcintype oid pg_type.oid Data type that the operator class indexes
opcdefault bool   True if this operator class is the default for opcintype
opckeytype oid pg_type.oid Type of data stored in index, or zero if same as opcintype

The majority of the information defining an operator class is actually not in its pg_opclass row, but in the associated rows in pg_amop and pg_amproc. Those rows are considered to be part of the operator class definition — this is not unlike the way that a relation is defined by a single pg_class row plus associated rows in pg_attribute and other tables.