> 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/indextypes/spgist/spgist-builtin-opclasses.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 65.3.2. 內建運算子類別

## 65.3.2. 內建運算子類別 [#](#spgist-builtin-opclasses) <a href="#spgist-builtin-opclasses" id="spgist-builtin-opclasses"></a>

PostgreSQL 核心發行版本包含[表 65.2](#spgist-builtin-opclasses-table) 所列的 SP-GiST 運算子類別。

### 表 65.2. 內建 SP-GiST 運算子類別 [#](#spgist-builtin-opclasses-table) <a href="#spgist-builtin-opclasses-table" id="spgist-builtin-opclasses-table"></a>

<table><thead><tr><th>名稱</th><th>可索引運算子</th><th>排序運算子</th></tr></thead><tbody><tr><td rowspan="12"><code>box_ops</code></td><td><code>&#x3C;&#x3C; (box,box)</code></td><td rowspan="12"><code>&#x3C;-> (box,point)</code></td></tr><tr><td><code>&#x26;&#x3C; (box,box)</code></td></tr><tr><td><code>&#x26;> (box,box)</code></td></tr><tr><td><code>>> (box,box)</code></td></tr><tr><td><code>&#x3C;@ (box,box)</code></td></tr><tr><td><code>@> (box,box)</code></td></tr><tr><td><code>~= (box,box)</code></td></tr><tr><td><code>&#x26;&#x26; (box,box)</code></td></tr><tr><td><code>&#x3C;&#x3C;| (box,box)</code></td></tr><tr><td><code>&#x26;&#x3C;| (box,box)</code></td></tr><tr><td><code>|&#x26;> (box,box)</code></td></tr><tr><td><code>|>> (box,box)</code></td></tr><tr><td rowspan="11"><code>inet_ops</code></td><td><code>&#x3C;&#x3C; (inet,inet)</code></td><td rowspan="11"> </td></tr><tr><td><code>&#x3C;&#x3C;= (inet,inet)</code></td></tr><tr><td><code>>> (inet,inet)</code></td></tr><tr><td><code>>>= (inet,inet)</code></td></tr><tr><td><code>= (inet,inet)</code></td></tr><tr><td><code>&#x3C;> (inet,inet)</code></td></tr><tr><td><code>&#x3C; (inet,inet)</code></td></tr><tr><td><code>&#x3C;= (inet,inet)</code></td></tr><tr><td><code>> (inet,inet)</code></td></tr><tr><td><code>>= (inet,inet)</code></td></tr><tr><td><code>&#x26;&#x26; (inet,inet)</code></td></tr><tr><td rowspan="6"><code>kd_point_ops</code></td><td><code>|>> (point,point)</code></td><td rowspan="6"><code>&#x3C;-> (point,point)</code></td></tr><tr><td><code>&#x3C;&#x3C; (point,point)</code></td></tr><tr><td><code>>> (point,point)</code></td></tr><tr><td><code>&#x3C;&#x3C;| (point,point)</code></td></tr><tr><td><code>~= (point,point)</code></td></tr><tr><td><code>&#x3C;@ (point,box)</code></td></tr><tr><td rowspan="12"><code>poly_ops</code></td><td><code>&#x3C;&#x3C; (polygon,polygon)</code></td><td rowspan="12"><code>&#x3C;-> (polygon,point)</code></td></tr><tr><td><code>&#x26;&#x3C; (polygon,polygon)</code></td></tr><tr><td><code>&#x26;> (polygon,polygon)</code></td></tr><tr><td><code>>> (polygon,polygon)</code></td></tr><tr><td><code>&#x3C;@ (polygon,polygon)</code></td></tr><tr><td><code>@> (polygon,polygon)</code></td></tr><tr><td><code>~= (polygon,polygon)</code></td></tr><tr><td><code>&#x26;&#x26; (polygon,polygon)</code></td></tr><tr><td><code>&#x3C;&#x3C;| (polygon,polygon)</code></td></tr><tr><td><code>&#x26;&#x3C;| (polygon,polygon)</code></td></tr><tr><td><code>|>> (polygon,polygon)</code></td></tr><tr><td><code>|&#x26;> (polygon,polygon)</code></td></tr><tr><td rowspan="6"><code>quad_point_ops</code></td><td><code>|>> (point,point)</code></td><td rowspan="6"><code>&#x3C;-> (point,point)</code></td></tr><tr><td><code>&#x3C;&#x3C; (point,point)</code></td></tr><tr><td><code>>> (point,point)</code></td></tr><tr><td><code>&#x3C;&#x3C;| (point,point)</code></td></tr><tr><td><code>~= (point,point)</code></td></tr><tr><td><code>&#x3C;@ (point,box)</code></td></tr><tr><td rowspan="10"><code>range_ops</code></td><td><code>= (anyrange,anyrange)</code></td><td rowspan="10"> </td></tr><tr><td><code>&#x26;&#x26; (anyrange,anyrange)</code></td></tr><tr><td><code>@> (anyrange,anyelement)</code></td></tr><tr><td><code>@> (anyrange,anyrange)</code></td></tr><tr><td><code>&#x3C;@ (anyrange,anyrange)</code></td></tr><tr><td><code>&#x3C;&#x3C; (anyrange,anyrange)</code></td></tr><tr><td><code>>> (anyrange,anyrange)</code></td></tr><tr><td><code>&#x26;&#x3C; (anyrange,anyrange)</code></td></tr><tr><td><code>&#x26;> (anyrange,anyrange)</code></td></tr><tr><td><code>-|- (anyrange,anyrange)</code></td></tr><tr><td rowspan="10"><code>text_ops</code></td><td><code>= (text,text)</code></td><td rowspan="10"> </td></tr><tr><td><code>&#x3C; (text,text)</code></td></tr><tr><td><code>&#x3C;= (text,text)</code></td></tr><tr><td><code>> (text,text)</code></td></tr><tr><td><code>>= (text,text)</code></td></tr><tr><td><code>~&#x3C;~ (text,text)</code></td></tr><tr><td><code>~&#x3C;=~ (text,text)</code></td></tr><tr><td><code>~>=~ (text,text)</code></td></tr><tr><td><code>~>~ (text,text)</code></td></tr><tr><td><code>^@ (text,text)</code></td></tr></tbody></table>

<br>

在 `point` 型別的兩個運算子類別中，`quad_point_ops` 是預設的。`kd_point_ops` 支援相同的運算子，但使用不同的索引資料結構，在某些應用中可能提供較佳的效能。

`quad_point_ops`、`kd_point_ops` 與 `poly_ops` 運算子類別支援 `<->` 排序運算子，可對被索引的點或多邊形資料集進行 k 最近鄰（`k-NN`）搜尋。

[返回 65.3. SP-GiST 索引](https://docs.postgresql.tw/19/internals/indextypes/spgist.md#spgist)

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/spgist.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/indextypes/spgist/spgist-builtin-opclasses.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.
