You can execute the SHOW INDEX statement to query the index information about a table, such as the index names, indexed fields, and index types.
Syntax
SHOW INDEX {FROM | IN} table_name;
Parameters
Parameter | Required | Description |
table_name | Yes | The name of the table
|
Examples
A table named exampletable1 contains a global secondary index index2 and two search indexes. You created a mapping table named search_exampletable 1 for one of the search indexes. The following examples show the query results of different mapping tables.
Example 1: Query the index information about a mapping table
The following sample code provides an example on how to query the index information about the exampletable1 table:
SHOW INDEX IN exampletable1;
The following figure shows a sample output.
Example 2: Query the index information about a mapping table for a search index
The following sample code provides an example on how to query the information about the search_exampletable1 table:
SHOW INDEX IN search_exampletable1;
The following figure shows a sample output.
References
If you want to use a specific search index to query data when you use the SQL query feature, you can execute the
CREATE TABLE
statement to create a mapping table for the search index. For more information, see Create mapping tables for search indexes.You can execute SQL statements to query data based on the fields of an index. For more information, see Query data.