Skip to main content
Version: 2.0.0 (latest)

3.23. Operator classes

Operator classes define how indexes can handle a specific data type. 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.

ch3.opclass-dialog.general1234567

General
#FieldGroup boxDescription
1TypeData type

The data type. Besides the built-in types, the list also holds the user-defined types, domains and other types of the model.

2With timezoneData type

For the time and timestamp types, uses the variant with time zone.

3DimensionData type

Number of dimensions when the type is an array (type[]). 0 means that the type is not an array.

4FormatData type

Read-only preview of the data type as it is written in the SQL code, with length, precision, dimension and other modifiers applied.

5Operator family

In the tab General, the operator family the operator class belongs to. In the tab Elements, the btree operator family that specifies the sorting mode of an ordering operator; it is used only when you want to create an element with data-sorting properties.

6Indexing

Index access method used by the operator class. Possible values are btree, brin, gist, gin, hash, and spgist.

7Default class

Indicates that the operator class is the default for the specified data type and index access method.

Operator class elements​

Operator class elements are the smallest units of an operator class. 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.

ch3.opclass-dialog.elements12345

Elements
#FieldDescription
1Element type

Type of the current element: Operator (an operator and its strategy number), Function (the function used as the index method support, with its support procedure number), or Storage (the data type actually stored in the index; generally the same as the column data type, but some access methods like GiST and GIN allow it to be overridden).

2Strategy

When the element being configured uses an operator this attribute is the index method's strategy number. When the element uses a function it becomes the index method's support procedure number. The value specified here is defined by each index access method used.

3Operator family

In the tab General, the operator family the operator class belongs to. In the tab Elements, the btree operator family that specifies the sorting mode of an ordering operator; it is used only when you want to create an element with data-sorting properties.

4Operator

The operator associated with the current element.

5Elements

The elements already added to the operator class. To create a valid operator class, at least one element must exist.

References​

Operator class DDL
https://www.postgresql.org/docs/current/static/sql-createopclass.html

More about operator classes
https://www.postgresql.org/docs/current/static/xindex.html