↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 运算符族 / GiST 操作符类

gist/point_ops (class)

point_ops 是 gist 的运算符类。

当前查看 PostgreSQL 18。

中文定义与说明

point_ops 是 gist 的运算符类。

名称
point_ops
运算符族
point_ops
索引访问方法
gist
默认类
是
存储键类型
box
输入类型
point

策略运算符

策略编号用途运算符左操作数类型右操作数类型排序运算符族
11搜索|>>(point,point)pointpoint
30搜索>^(point,point)pointpoint
1搜索<<(point,point)pointpoint
5搜索>>(point,point)pointpoint
10搜索<<|(point,point)pointpoint
29搜索<^(point,point)pointpoint
6搜索~=(point,point)pointpoint
15排序<->(point,point)pointpointfloat_ops
28搜索<@(point,box)pointbox
48搜索<@(point,polygon)pointpolygon
68搜索<@(point,circle)pointcircle

支持函数

支持函数编号实现函数左操作数类型右操作数类型结果类型
1gist_point_consistent(internal,point,int2,oid,internal)pointpointbool
2gist_box_union(internal,internal)pointpointbox
3gist_point_compress(internal)pointpointinternal
5gist_box_penalty(internal,internal,internal)pointpointinternal
6gist_box_picksplit(internal,internal)pointpointinternal
7gist_box_same(box,box,internal)pointpointinternal
8gist_point_distance(internal,point,int2,oid,internal)pointpointfloat8
9gist_point_fetch(internal)pointpointinternal
11gist_point_sortsupport(internal)pointpointvoid

同版本中文手册节选

一个索引定义可以为索引的每一列指定一个操作符类。

操作符类标识该索引在该列上要使用哪些操作符。例如,类型 int4 上的一个 B-树索引会使用 int4_ops 类;这个操作符类包含对 int4 值进行比较所需的函数。实践中,列数据类型的默认操作符类通常已经足够。之所以存在操作符类,主要是因为对某些数据类型来说,可能存在多种有意义的索引行为。例如,我们可能希望按绝对值排序一种复数数据类型,也可能希望按实部排序。我们可以通过为该数据类型定义两个操作符类,并在创建索引时选择合适的那个来做到这一点。操作符类决定了基础排序顺序(之后还可以通过添加排序选项 COLLATE、ASC/DESC 和/或 NULLS FIRST/NULLS LAST 来修改)。

除了默认操作符类之外,还有一些内置操作符类:

下面的查询会显示所有已定义的操作符类:

查看完整中文手册与上下文。

说明

point_ops 是 gist 的运算符类。

对象种类
操作符类
索引访问方法
GiST
输入类型
point
存储键类型
box
默认操作符类
是

用法

gist/point_ops

操作符类与家族

一个索引定义可以为索引的每一列指定一个 操作符类 。

操作符类标识该索引在该列上要使用哪些操作符。例如,类型 int4 上的一个 B-树索引会使用 int4_ops 类;这个操作符类包含对 int4 值进行比较所需的函数。实践中,列数据类型的默认操作符类通常已经足够。之所以存在操作符类,主要是因为对某些数据类型来说,可能存在多种有意义的索引行为。例如,我们可能希望按绝对值排序一种复数数据类型,也可能希望按实部排序。我们可以通过为该数据类型定义两个操作符类,并在创建索引时选择合适的那个来做到这一点。操作符类决定了基础排序顺序(之后还可以通过添加排序选项 COLLATE 、 ASC / DESC 和/或 NULLS FIRST / NULLS LAST 来修改)。

除了默认操作符类之外,还有一些内置操作符类:

家族中的操作符策略

操作符重载策略用途排序家族成员范围源码说明
|>>(point,point)11搜索操作符类输入类型对位于上方
>^(point,point)30搜索操作符类输入类型对已弃用,请改用 |>>
<<(point,point)1搜索操作符类输入类型对位于左侧
>>(point,point)5搜索操作符类输入类型对位于右侧
<<|(point,point)10搜索操作符类输入类型对位于下方
<^(point,point)29搜索操作符类输入类型对已弃用,请改用 <<|
~=(point,point)6搜索操作符类输入类型对相同
<->(point,point)15排序float_ops操作符类输入类型对两者之间的距离
<@(point,box)28搜索家族成员点位于矩形框内
<@(point,polygon)48搜索家族成员被包含于
<@(point,circle)68搜索家族成员被包含于

家族支持函数

支持函数编号左侧类型右侧类型函数签名返回类型
1pointpointgist_point_consistent(internal,point,int2,oid,internal)bool
2pointpointgist_box_union(internal,internal)box
3pointpointgist_point_compress(internal)internal
5pointpointgist_box_penalty(internal,internal,internal)internal
6pointpointgist_box_picksplit(internal,internal)internal
7pointpointgist_box_same(box,box,internal)internal
8pointpointgist_point_distance(internal,point,int2,oid,internal)float8
9pointpointgist_point_fetch(internal)internal
11pointpointgist_point_sortsupport(internal)void

本家族的操作符类

操作符类输入类型键类型默认值
point_opspointbox是

相关条目

文档与源码

来源构建
版本
18.6
构建
https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
来源指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

版本比较

PostgreSQL 17 → 18: 无变化。

比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。

相关条目

导出 JSON · 返回运算符族 · 收录范围为 PostgreSQL 10 至 20;最早采样版本不一定是实际引入版本。