gist/box_ops (class)
box 类型的 GiST 操作符类,属于 box_ops 家族。
当前查看 PostgreSQL 18.6。
说明
box 类型的 GiST 操作符类,属于 box_ops 家族。
- 对象种类
- 操作符类
- 索引访问方法
- GiST
- 输入类型
- box
- 存储键类型
- 与输入类型相同(目录值为零)
- 默认操作符类
- 是
用法
gist/box_ops操作符类与家族
一个索引定义可以为索引的每一列指定一个 操作符类 。
操作符类标识该索引在该列上要使用哪些操作符。例如,类型 int4 上的一个 B-树索引会使用 int4_ops 类;这个操作符类包含对 int4 值进行比较所需的函数。实践中,列数据类型的默认操作符类通常已经足够。之所以存在操作符类,主要是因为对某些数据类型来说,可能存在多种有意义的索引行为。例如,我们可能希望按绝对值排序一种复数数据类型,也可能希望按实部排序。我们可以通过为该数据类型定义两个操作符类,并在创建索引时选择合适的那个来做到这一点。操作符类决定了基础排序顺序(之后还可以通过添加排序选项 COLLATE 、 ASC / DESC 和/或 NULLS FIRST / NULLS LAST 来修改)。
除了默认操作符类之外,还有一些内置操作符类:
家族中的操作符策略
| 操作符重载 | 策略 | 用途 | 排序家族 | 成员范围 | 源码说明 |
|---|---|---|---|---|---|
| <<(box,box) | 1 | 搜索 | 操作符类输入类型对 | 位于左侧 | |
| &<(box,box) | 2 | 搜索 | 操作符类输入类型对 | 重叠或位于左侧 | |
| &&(box,box) | 3 | 搜索 | 操作符类输入类型对 | 重叠 | |
| &>(box,box) | 4 | 搜索 | 操作符类输入类型对 | 重叠或位于右侧 | |
| >>(box,box) | 5 | 搜索 | 操作符类输入类型对 | 位于右侧 | |
| ~=(box,box) | 6 | 搜索 | 操作符类输入类型对 | 相同 | |
| @>(box,box) | 7 | 搜索 | 操作符类输入类型对 | 包含 | |
| <@(box,box) | 8 | 搜索 | 操作符类输入类型对 | 被包含于 | |
| &<|(box,box) | 9 | 搜索 | 操作符类输入类型对 | 重叠或位于下方 | |
| <<|(box,box) | 10 | 搜索 | 操作符类输入类型对 | 位于下方 | |
| |>>(box,box) | 11 | 搜索 | 操作符类输入类型对 | 位于上方 | |
| |&>(box,box) | 12 | 搜索 | 操作符类输入类型对 | 重叠或位于上方 | |
| <->(box,point) | 15 | 排序 | float_ops | 家族成员 | 两者之间的距离 |
家族支持函数
| 支持函数编号 | 左侧类型 | 右侧类型 | 函数签名 | 返回类型 |
|---|---|---|---|---|
| 1 | box | box | gist_box_consistent(internal,box,int2,oid,internal) | bool |
| 2 | box | box | gist_box_union(internal,internal) | box |
| 5 | box | box | gist_box_penalty(internal,internal,internal) | 内部 |
| 6 | box | box | gist_box_picksplit(internal,internal) | 内部 |
| 7 | box | box | gist_box_same(box,box,internal) | 内部 |
| 8 | box | box | gist_box_distance(internal,box,int2,oid,internal) | float8 |
| 12 | any | any | gist_translate_cmptype_common(int4) | int2 |
本家族的操作符类
相关条目
文档与源码
- Matching PostgreSQL source archive
- PostgreSQL 18 English manual: indexes-opclass.html
- PostgreSQL 18 English manual: catalog-pg-opclass.html
- PostgreSQL 18 English manual: catalog-pg-amop.html
- PostgreSQL 18 English manual: catalog-pg-amproc.html
来源构建
- 版本
- 18.6
- 构建
- https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- 来源指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f
版本比较
PostgreSQL 10 → 11: 属性变化。
以下差异保留原始字段名与英文源描述。
--- PostgreSQL 10
+++ PostgreSQL 11
@@ -181,24 +181,6 @@
},
{
"family": "box_ops",
- "function": "gist_box_compress(internal)",
- "left_type": "box",
- "method": "gist",
- "number": "3",
- "result_type": "internal",
- "right_type": "box"
- },
- {
- "family": "box_ops",
- "function": "gist_box_decompress(internal)",
- "left_type": "box",
- "method": "gist",
- "number": "4",
- "result_type": "internal",
- "right_type": "box"
- },
- {
- "family": "box_ops",
"function": "gist_box_penalty(internal,internal,internal)",
"left_type": "box",
"method": "gist",
@@ -221,15 +203,6 @@
"left_type": "box",
"method": "gist",
"number": "7",
- "result_type": "internal",
- "right_type": "box"
- },
- {
- "family": "box_ops",
- "function": "gist_box_fetch(internal)",
- "left_type": "box",
- "method": "gist",
- "number": "9",
"result_type": "internal",
"right_type": "box"
}
比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。
相关条目
导出 JSON · 返回运算符族 · 收录范围为 PostgreSQL 10 至 20;最早采样版本不一定是实际引入版本。