> 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/19/internals/catalogs/catalog-pg-opclass.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 52.33. pg\_opclass \#

### 52.33. `pg_opclass` [#](#catalog-pg-opclass) <a href="#catalog-pg-opclass" id="catalog-pg-opclass"></a>

目錄 `pg_opclass` 定義索引存取方法的運算子類別。每個運算子類別為特定資料型別與特定索引存取方法的索引欄位定義語意。運算子類別本質上是指定某個特定的運算子家族適用於某個特定的可索引欄位資料型別。該家族中實際可用於此索引欄位的運算子，就是那些接受該欄位資料型別作為左側輸入的運算子。

[第 36.16 節](https://docs.postgresql.tw/19/server-programming/extend/xindex.md)詳細說明了運算子類別。

#### 表 52.33. `pg_opclass` 欄位 [#](#catalog-pg-opclass-columns) <a href="#catalog-pg-opclass-columns" id="catalog-pg-opclass-columns"></a>

| <p>欄位類型</p><p>說明</p>                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>oid</code> <code>oid</code></p><p>資料列識別碼</p>                                                                                                                                                                           |
| <p><code>opcmethod</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-am.md"><code>pg\_am</code></a>.<code>oid</code>）</p><p>此運算子類別所適用的索引存取方法</p>                                 |
| <p><code>opcname</code> <code>name</code></p><p>此運算子類別的名稱</p>                                                                                                                                                                   |
| <p><code>opcnamespace</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-namespace.md"><code>pg\_namespace</code></a>.<code>oid</code>）</p><p>此運算子類別的命名空間</p>                     |
| <p><code>opcowner</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-authid.md"><code>pg\_authid</code></a>.<code>oid</code>）</p><p>此運算子類別的擁有者</p>                                |
| <p><code>opcfamily</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-opfamily.md"><code>pg\_opfamily</code></a>.<code>oid</code>）</p><p>包含此運算子類別的運算子家族</p>                       |
| <p><code>opcintype</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-type.md"><code>pg\_type</code></a>.<code>oid</code>）</p><p>此運算子類別所索引的資料型別</p>                               |
| <p><code>opcdefault</code> <code>bool</code></p><p>若此運算子類別是 <code>opcintype</code> 的預設運算子類別，則為 true</p>                                                                                                                         |
| <p><code>opckeytype</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-type.md"><code>pg\_type</code></a>.<code>oid</code>）</p><p>儲存於索引中的資料型別；若與 <code>opcintype</code> 相同則為零</p> |

<br>

運算子類別的 `opcmethod` 必須與包含它的運算子家族的 `opfmethod` 相符。此外，對於任何給定的 `opcmethod` 與 `opcintype` 組合，`opcdefault` 為 true 的 `pg_opclass` 資料列不得超過一個。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/catalog-pg-opclass.html)（原文版本：18.6；核對日期：2026-10-17）


---

# 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/19/internals/catalogs/catalog-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.
