Operator classes define how a specific data type can be handled by indexes. This kind of object specifies a set of elements composed of operators, functions or storage modes that will fill a particular role or strategy when dealing with the data type combined with the index access method.
Attribute | Description |
---|---|
Indexing |
Index access method used by the operator class. Possible values are btree , gin , gist , hash , spgist and brin . |
Default Class |
Indicates that the operator class is the default for the specified data type and index access method. |
Operator Family |
Defines the operator family in which the operator class will be included. Details about operator families can be seen in the next section Operator families. |
Data Type |
Data type in which the operator class works. |
Elements |
The group of fields that are used to configure the operator class elements. These objects are detailed in the next subsection. |
Operator class elements are the small unit of an operator class. In order to create a valid operator class at least one element must exist. These objects can be constructed using an operator, function, or storage data type as detailed in the table below.
Attribute | Description |
---|---|
Element Type |
Type of the current element. It can be: Operator , Function , or Storage . |
Operator |
Indicates the operator to be associated with the current element. |
Operator Family |
Defines the btree operator family that specifies the sorting mode of an ordering operator. This attribute is used only when you want to create an element with data-sorting properties. |
Function |
Defines the function used as the index method support for the operator class. |
Storage Type |
Specifies the data type that is in fact stored in the index. Generally, this is the same as the column data type. But there are some index access methods (like GiST and GIN) that allow this type to be overridden. |
Support / Strategy |
When the element being configured uses an operator this attribute is the index method's strategy number. Now, when the element is using a function this is the index method's support procedure number. The value specified here is defined by each index access method used. |
Operator class DDL
https://www.postgresql.org/docs/current/static/sql-createopclass.html
More about operator classes