62.2. Встроенные классы операторов

В базовый дистрибутив Postgres Pro включены классы операторов SP-GiST, перечисленные в Таблице 62.1.

Таблица 62.1. Встроенные классы операторов SP-GiST

ИмяИндексируемый тип данныхИндексируемые операторыОператоры упорядочивания
kd_point_opspoint<< <@ <^ >> >^ ~=<->
quad_point_opspoint<< <@ <^ >> >^ ~=<->
range_opsлюбой тип диапазона&& &< &> -|- << <@ = >> @>
box_opsbox<< &< && &> >> ~= @> <@ &<| <<| |>> |&><->
poly_opspolygon<< &< && &> >> ~= @> <@ &<| <<| |>> |&><->
text_opstext< <= = > >= ~<=~ ~<~ ~>=~ ~>~ ^@
inet_opsinet, cidr&& >> >>= > >= <> << <<= < <= =

Из двух классов операторов для типа point классом по умолчанию является quad_point_ops. Класс kd_point_ops поддерживает те же операторы, но использует другую структуру данных индекса, которая может дать выигрыш в скорости для некоторых приложений.

Классы операторов quad_point_ops, kd_point_ops и poly_ops поддерживают оператор упорядочивания <->, позволяющий выполнить поиск k ближайших соседей (k-NN) по индексированному набору точек или многоугольников.

62.2. Built-in Operator Classes

The core Postgres Pro distribution includes the SP-GiST operator classes shown in Table 62.1.

Table 62.1. Built-in SP-GiST Operator Classes

NameIndexed Data TypeIndexable OperatorsOrdering Operators
kd_point_opspoint<< <@ <^ >> >^ ~=<->
quad_point_opspoint<< <@ <^ >> >^ ~=<->
range_opsany range type&& &< &> -|- << <@ = >> @>
box_opsbox<< &< && &> >> ~= @> <@ &<| <<| |>> |&><->
poly_opspolygon<< &< && &> >> ~= @> <@ &<| <<| |>> |&><->
text_opstext< <= = > >= ~<=~ ~<~ ~>=~ ~>~ ^@
inet_opsinet, cidr&& >> >>= > >= <> << <<= < <= =

Of the two operator classes for type point, quad_point_ops is the default. kd_point_ops supports the same operators but uses a different index data structure that may offer better performance in some applications.

The quad_point_ops, kd_point_ops and poly_ops operator classes support the <-> ordering operator, which enables the k-nearest neighbor (k-NN) search over indexed point or polygon data sets.

FAQ