All Products
Search
Document Center

ApsaraDB for SelectDB:Bitmap indexes

Last Updated:May 09, 2024

This topic describes bitmap indexes in ApsaraDB for SelectDB and how to use the bitmap indexes.

Background information

A bitmap index is a data structure that can be quickly created and accelerates queries. This topic describes how to create a bitmap index. This topic also describes the usage notes and common issues about creating a bitmap index.

Create a bitmap index

Syntax:

CREATE INDEX [IF NOT EXISTS] <index_name> ON <table_name> (<column>) USING BITMAP;

The following table describes the parameters.

Parameter

Description

table_name

The name of the table for which you want to create a bitmap index.

column

The name of the column on which you want to create a bitmap index.

Query information about a bitmap index

Syntax:

SHOW INDEX FROM [db_name.]<table_name>;

Delete a bitmap index

Syntax:

DROP INDEX [IF EXISTS] index_name ON [db_name.]table_name;

Usage notes

  • You can create a bitmap index only on a single column.

  • Bitmap indexes can be applied to all columns in the Duplicate or Unique key model and key columns in the Aggregate key model.

  • Bitmap indexes take effect only on data in the Segment V2 format. When you create a bitmap index for a table, the storage format of the table is converted to the Segment V2 format by default.

  • Bitmap indexes support the following data types:

    • TINYINT

    • SMALLINT

    • INT

    • BIGINT

    • CHAR

    • VARCHAR

    • DATE

    • DATETIME

    • LARGEINT

    • DECIMAL

    • BOOL