> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/internals/system-catalogs/pg_opclass.md).

# 51.33. 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. 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.

Operator classes are described at length in [Section 37.14](https://www.postgresql.org/docs/10/static/xindex.html).

**Table 51.33. `pg_opclass` Columns**

| Name           | Type   | References                                                                                | Description                                                    |
| -------------- | ------ | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `oid`          | `oid`  |                                                                                           | Row identifier (hidden attribute; must be explicitly selected) |
| `opcmethod`    | `oid`  | [`pg_am`](https://www.postgresql.org/docs/10/static/catalog-pg-am.html).oid               | Index access method operator class is for                      |
| `opcname`      | `name` |                                                                                           | Name of this operator class                                    |
| `opcnamespace` | `oid`  | [`pg_namespace`](https://www.postgresql.org/docs/10/static/catalog-pg-namespace.html).oid | Namespace of this operator class                               |
| `opcowner`     | `oid`  | [`pg_authid`](https://www.postgresql.org/docs/10/static/catalog-pg-authid.html).oid       | Owner of the operator class                                    |
| `opcfamily`    | `oid`  | [`pg_opfamily`](https://www.postgresql.org/docs/10/static/catalog-pg-opfamily.html).oid   | Operator family containing the operator class                  |
| `opcintype`    | `oid`  | [`pg_type`](https://www.postgresql.org/docs/10/static/catalog-pg-type.html).oid           | Data type that the operator class indexes                      |
| `opcdefault`   | `bool` |                                                                                           | True if this operator class is the default for `opcintype`     |
| `opckeytype`   | `oid`  | [`pg_type`](https://www.postgresql.org/docs/10/static/catalog-pg-type.html).oid           | Type of data stored in index, or zero if same as `opcintype`   |

An operator class's `opcmethod` must match the `opfmethod` of its containing operator family. Also, there must be no more than one `pg_opclass` row having `opcdefault` true for any given combination of `opcmethod` and `opcintype`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/internals/system-catalogs/pg_opclass.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
