Index (V2.0)

Updated at:
Copy as MD

By default, AnalyticDB for MySQL creates a full index when you create a table. This means an index is created for every column. Avoid using unindexed columns for filtering or calculations in your queries.

Use cases

A common use case involves VARCHAR columns that store data entries longer than 16 KB.

Procedure

  • When creating a table with DMS for AnalyticDBColumn informationNo index, go to the Column Information section. In the Extended Information area at the bottom of the section, select No Index from the drop-down list.
  • When you create a table by using the CREATE TABLE (V2.0) statement, add disableIndex true to the column definition. For example, the following statement defines the name column in the test table without an index:
      CREATE TABLE 
      adb_test.test (
      id bigint NOT NULL , 
      name varchar  disableIndex true , 
      primary key (id)
      )
      PARTITION BY HASH KEY(id) PARTITION NUM 128
      TABLEGROUP table_group
      OPTIONS(UPDATETYPE='realtime');
  • To remove an index from a column of an existing table, contact technical support.