Updated on 2024-05-29 GMT+08:00

Introduction to Global Secondary Indexes

Scenarios

HBase secondary indexes can be used to accelerate conditional queries with filters. HBase secondary indexes support local secondary indexes (HIndexes) and global secondary indexes (GSIs). Compared with local indexes (HIndex), global secondary indexes have better query performance and are suitable for scenarios that require high read latency.

HBase global secondary indexes use independent index tables to store index data. When a given query condition can hit an index, a full table query on a data table can be converted into an exact range query on an index table, thereby improving a query speed. After the global secondary index feature is enabled, the code on the application side does not need to be modified, which is easy to use.

For MRS 3.3.0 or later, HBase global secondary index is enable by default. To modify the related parameters, log in to FusionInsight Manager, choose Cluster > Services > HBase > Confiurations > All Configurations, select RegionServer(Role) > Secondary Indexes and HMaster(Role) > Secondary Indexes.

HBase global secondary indexes support the following key features:

  • Composite Index

    Multiple columns can be specified as index columns (cross-column-family is supported).

  • Overwrite Index

    Multiple columns or column families can be specified as overwrite columns or column families and stored in the index table in redundancy mode. This function is used to quickly query non-index columns in index query.

  • Index TTL

    Index table TTL is used when TTL is enabled for a data table. To ensure consistency with the data table, the index table TTL automatically inherits the TTL of the index column and overwrites column of the data table and cannot be manually specified.

  • Online index change

    Indexes can be created, deleted, and their status can be modified online without affecting data table read and write.

  • Online index repair

    When the index data hit by the query is invalid, index repair can be triggered to ensure that the final query result is correct.

  • Index Tool

    Supports index consistency check, index repair, index creation, deletion, and status modification, and index data rebuilding.