About Indexes

An index is a database structure that enables you to retrieve data from database tables efficiently.

Indexes provide fast access to the rows of a table when the key(s) you are searching on is contained in the index.

An index is defined by its name, the name of the table that it indexes, and a list of one or more index paths that specify which table columns or nested fields are indexed.

An index is an ordered map in which each row of the data is called an entry.

An index can be created on atomic data types, arrays, maps, JSON, and GeoJSON data.

An index can store the following special values:
  • NULL
  • json null (It is applicable only for JSON indexes)

Example 8-1 Indexes Example

The following is an example of creating an index. The index is created on the age field present in the info JSON field in the UserInfo table.

CREATE INDEX indexdemo1 ON UserInfo(info.age AS ANYATOMIC);