View Index
You can view the indexes in your database.
SHOW INDEXES
The SHOW INDEXES statement provides the list of indexes present in the specified table. If you want the output to be in JSON format, you can specify the optional AS JSON.
Example 1: List indexes on the
BaggageInfo
table.SHOW INDEXES ON baggageInfo
indexes
jsonindex_routing
jsonindex_tagnum
simpleindex_arrival
nonull_phone
Example 2: List indexes on the
BaggageInfo
table
in JSON
format.SHOW AS JSON INDEXES ON baggageInfo
{"indexes" :
["jsonindex_routing","jsonindex_tagnum","simpleindex_arrival"]}
DESCRIBE INDEX
The DESCRIBE INDEX statement defines the specified index on a table. If you want the output to be in JSON format, you can specify the optional AS JSON.
The description for the index contains the following information:
- Name of the table on which the index is defined.
- Name of the index.
- Type of index. Whether the index is primary index or secondary index.
- Whether the index is multikey? If the index is multikey then 'Y' is displayed. Otherwise, 'N' is displayed.
- List of fields on which the index is defined.
- The declared type of the index.
- Description of the index.
Example 1: Describe the index
multikeyindex3
.DESCRIBE INDEX multikeyindex3 ON stream_acct
+-------------+----------------+-----------+----------+-----------------------------------+--------------+-------------+
table | name | type | multiKey | fields | declaredType | description
+-------------+----------------+-----------+----------+-----------------------------------+--------------+-------------+
stream_acct | multikeyindex3 | SECONDARY | Y | acct_data.country | ANY_ATOMIC | | | |
| | | | acct_data.contentStreamed[].seriesInfo[].episodes[]| ANY_ATOMIC |
+-------------+----------------+-----------+----------+-----------------------------------+--------------+-------------+
Example 2: Describe the index
idx_showid_year_month
in JSON format.
DESCRIBE AS JSON INDEX idx_showid_year_month ON stream_acct
{
"name" : "idx_showid_year_month",
"type" : "secondary",
"fields" : ["acct_data.contentStreamed[].showId", "substring#acct_data.contentStreamed[].seriesInfo[].episodes[].date@,0,4", "substring#acct_data.contentStreamed[].seriesInfo[].episodes[].date@,5,2"],
"types" : ["INTEGER", "STRING", "STRING"],
"withNoNulls" : false,
"withUniqueKeysPerRow" : false
}