DEV Community

Qing
Qing

Posted on

Data Types(8)

Indexes

GiST and SP-GiST indexes can be created for table columns of the range type. For example, to create a GiST index, run the following command:

*CREATE INDEX reservation_idx ON reservation USING GIST (during); *

A GiST or SP-GiST index can accelerate queries involving the following range operators: =, &&, <@, @>, «, >>, -|-, &<, and &>.

In addition, the B-tree and hash index can be created on table columns of the range type. For these index types, basically the only useful range operation is equivalence. Using the corresponding < and > operators, there is a B-tree sort oder for range value definitions, but that order is fairly arbitrary and is often less useful in the reality. The B-tree and hash support for range types is primarily designed to allow sorting and hashing within a query, rather than creating an index.

OID Types

OIDs are used internally by openGauss as primary keys for various system catalogs. OIDs are not added to user-created tables by the system. The OID type represents an object identifier.

The OID type is currently implemented as an unsigned four-byte integer. So, using a user-created table's OID column as a primary key is discouraged.

Table 15 OID types

Image description

The OID type is used for a column in the database system catalog.

Example:

Image description

The alias type of the OID is REGCLASS which allows simplified search for OID values.

Example:

Image description
Image description

Top comments (0)