> 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/catalogs/catalog-pg-amop.md).

# 52.4. pg\_amop \#

The catalog `pg_amop` stores information about operators associated with access method operator families. There is one row for each operator that is a member of an operator family. A family member can be either a *search* operator or an *ordering* operator. An operator can appear in more than one family, but cannot appear in more than one search position nor more than one ordering position within a family. (It is allowed, though unlikely, for an operator to be used for both search and ordering purposes.)

**Table 52.4. `pg_amop` Columns**

| <p>Column Type</p><p>Description</p>                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p><code>oid</code> <code>oid</code></p><p>Row identifier</p>                                                                                                                                                                                                            |
| <p><code>amopfamily</code> <code>oid</code> (references <a href="/pages/voBFeBnK5yHy01NuXaYn"><code>pg\_opfamily</code></a>.<code>oid</code>)</p><p>The operator family this entry is for</p>                                                                            |
| <p><code>amoplefttype</code> <code>oid</code> (references <a href="/pages/Rnbzy6x669U98OjJh3D7"><code>pg\_type</code></a>.<code>oid</code>)</p><p>Left-hand input data type of operator</p>                                                                              |
| <p><code>amoprighttype</code> <code>oid</code> (references <a href="/pages/Rnbzy6x669U98OjJh3D7"><code>pg\_type</code></a>.<code>oid</code>)</p><p>Right-hand input data type of operator</p>                                                                            |
| <p><code>amopstrategy</code> <code>int2</code></p><p>Operator strategy number</p>                                                                                                                                                                                        |
| <p><code>amoppurpose</code> <code>char</code></p><p>Operator purpose, either <code>s</code> for search or <code>o</code> for ordering</p>                                                                                                                                |
| <p><code>amopopr</code> <code>oid</code> (references <a href="/pages/gJEllT61m6FTxxJgK6D0"><code>pg\_operator</code></a>.<code>oid</code>)</p><p>OID of the operator</p>                                                                                                 |
| <p><code>amopmethod</code> <code>oid</code> (references <a href="/pages/4AYp7PxsLlXx7fY4PQp8"><code>pg\_am</code></a>.<code>oid</code>)</p><p>Index access method operator family is for</p>                                                                             |
| <p><code>amopsortfamily</code> <code>oid</code> (references <a href="/pages/voBFeBnK5yHy01NuXaYn"><code>pg\_opfamily</code></a>.<code>oid</code>)</p><p>The B-tree operator family this entry sorts according to, if an ordering operator; zero if a search operator</p> |

<br>

A “search” operator entry indicates that an index of this operator family can be searched to find all rows satisfying `WHERE` *`indexed_column`* *`operator`* *`constant`*. Obviously, such an operator must return `boolean`, and its left-hand input type must match the index's column data type.

An “ordering” operator entry indicates that an index of this operator family can be scanned to return rows in the order represented by `ORDER BY` *`indexed_column`* *`operator`* *`constant`*. Such an operator could return any sortable data type, though again its left-hand input type must match the index's column data type. The exact semantics of the `ORDER BY` are specified by the `amopsortfamily` column, which must reference a B-tree operator family for the operator's result type.

## Note

At present, it's assumed that the sort order for an ordering operator is the default for the referenced operator family, i.e., `ASC NULLS LAST`. This might someday be relaxed by adding additional columns to specify sort options explicitly.

An entry's `amopmethod` must match the `opfmethod` of its containing operator family (including `amopmethod` here is an intentional denormalization of the catalog structure for performance reasons). Also, `amoplefttype` and `amoprighttype` must match the `oprleft` and `oprright` fields of the referenced [`pg_operator`](/internals/catalogs/catalog-pg-operator.md) entry.

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/catalog-pg-amop.html)（英文原文，待翻譯）


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.postgresql.tw/internals/catalogs/catalog-pg-amop.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
