核心 PostgreSQL 发行版包括 表 69.1 中所示的 SP-GiST 运算符类。
表 69.1. 内置 SP-GiST 运算符类
名称 | 可索引运算符 | 排序运算符 |
---|---|---|
box_ops |
<< (box,box) |
<-> (box,point) |
&< (box,box) |
||
&> (box,box) |
||
>> (box,box) |
||
<@ (box,box) |
||
@> (box,box) |
||
~= (box,box) |
||
&& (box,box) |
||
<<| (box,box) |
||
&<| (box,box) |
||
|&> (box,box) |
||
|>> (box,box) |
||
inet_ops |
<< (inet,inet) |
|
<<= (inet,inet) |
||
>> (inet,inet) |
||
>>= (inet,inet) |
||
= (inet,inet) |
||
<> (inet,inet) |
||
< (inet,inet) |
||
<= (inet,inet) |
||
> (inet,inet) |
||
>= (inet,inet) |
||
&& (inet,inet) |
||
kd_point_ops |
|>> (point,point) |
<-> (point,point) |
<< (point,point) |
||
>> (point,point) |
||
<<| (point,point) |
||
~= (point,point) |
||
<@ (point,box) |
||
poly_ops |
<< (polygon,polygon) |
<-> (polygon,point) |
&< (polygon,polygon) |
||
&> (polygon,polygon) |
||
>> (polygon,polygon) |
||
<@ (polygon,polygon) |
||
@> (polygon,polygon) |
||
~= (polygon,polygon) |
||
&& (polygon,polygon) |
||
<<| (polygon,polygon) |
||
&<| (polygon,polygon) |
||
|>> (polygon,polygon) |
||
|&> (polygon,polygon) |
||
quad_point_ops |
|>> (point,point) |
<-> (point,point) |
<< (point,point) |
||
>> (point,point) |
||
<<| (point,point) |
||
~= (point,point) |
||
<@ (point,box) |
||
range_ops |
= (anyrange,anyrange) |
|
&& (anyrange,anyrange) |
||
@> (anyrange,anyelement) |
||
@> (anyrange,anyrange) |
||
<@ (anyrange,anyrange) |
||
<< (anyrange,anyrange) |
||
>> (anyrange,anyrange) |
||
&< (anyrange,anyrange) |
||
&> (anyrange,anyrange) |
||
-|- (anyrange,anyrange) |
||
text_ops |
= (text,text) |
|
< (text,text) |
||
<= (text,text) |
||
> (text,text) |
||
>= (text,text) |
||
~<~ (text,text) |
||
~<=~ (text,text) |
||
~>=~ (text,text) |
||
~>~ (text,text) |
||
^@ (text,text) |
对于类型 point
的两个运算符类,quad_point_ops
是默认值。 kd_point_ops
支持相同的运算符,但使用不同的索引数据结构,在某些应用程序中可能提供更好的性能。
quad_point_ops
、kd_point_ops
和 poly_ops
运算符类支持 <->
排序运算符,这使得可以对索引点或多边形数据集进行 k 个最近邻 (k-NN
) 搜索。