SHOW (ALL) INDEXES command¶
The SHOW ALL INDEXES command returns information about all indexes in the schema that is set in the current session.
The SHOW INDEXES command returns information about the indexes created on a specific graph or temporary graph.
To specify the graph or temporary graph, use either of the following methods:
- Add a USE clause before this command to set the working graph.
- Use SESSION SET to set the graph or temporary graph for the current session in advance.
If both methods are used, the one specified in the USE clause takes precedence. If neither is used, an error occurs.
For persistent objects, the current user must have USAGE on the parent schema. This requirement does not apply to temporary graphs. For more information, see Schema access control.
Note
This command returns information about indexes created by users only. It does not return information about system-created indexes.
The following table describes the returned information:
| Column | Description |
|---|---|
name |
The name of the index. |
state |
The state of the index. Valid values: Valid and Building. |
index_type |
The type of the index. Valid values: Normal, Vector, Spatial, and Fulltext. For vector indexes, this field contains details about the vector index, such as similarity metric, dimension, and other options. For more information, see CREATE VECTOR INDEX. For spatial indexes, this field contains details about the spatial index, such as maximum level grid and maximum number of covering cells. For more information, see CREATE SPATIAL INDEX. |
schema |
The schema to which the index belongs. |
graph_name |
The name of the graph or temporary graph to which the index belongs. |
entity_type |
The type of graph element on which the index is created. Valid values: NODE and EDGE. |
element_type |
The name of the graph element on which the index is created. |
properties |
The list of properties based on which the index is created. |
Syntax¶
- show_all_indexes_command
- show_indexes_command
show_all_indexes_command ::=
'SHOW' 'ALL' 'INDEXES'
show_indexes_command ::=
'SHOW' 'INDEXES'
Examples¶
The following examples are based on the example dataset. For how to create indexes of different types, see Indexes overview.
Show indexes for a graph¶
USE movie SHOW INDEXES
Return:
+------------------+-------+------------+-----------------+------------+-------------+--------------+-------------------+
| name | state | index_type | schema | graph_name | entity_type | element_type | properties |
+------------------+-------+------------+-----------------+------------+-------------+--------------+-------------------+
| idx_actor_age | Valid | Normal | /default_schema | movie | Node | Actor | ["birthDate ASC"] |
| idx_watch_rating | Valid | Normal | /default_schema | movie | Edge | Watch | ["rate DESC"] |
+------------------+-------+------------+-----------------+------------+-------------+--------------+-------------------+
Show indexes for a temporary graph¶
USE #movie_temporary_graph SHOW INDEXES
Return:
+-----------------------+-------+------------+-------------+------------------------+-------------+--------------+-------------------+
| name | state | index_type | schema | graph_name | entity_type | element_type | properties |
+-----------------------+-------+------------+-------------+------------------------+-------------+--------------+-------------------+
| idx_actor_age_temp | Valid | Normal | /tmp_schema | #movie_temporary_graph | Node | Actor | ["birthDate ASC"] |
| idx_watch_rating_temp | Valid | Normal | /tmp_schema | #movie_temporary_graph | Edge | Watch | ["rate DESC"] |
+-----------------------+-------+------------+-------------+------------------------+-------------+--------------+-------------------+
Show all indexes in current schema¶
SHOW ALL INDEXES
Return:
+-----------------------+-------+------------------------------------------------------------------------+-----------------+------------------------+-------------+--------------+-------------------+
| name | state | index_type | schema | graph_name | entity_type | element_type | properties |
+-----------------------+-------+------------------------------------------------------------------------+-----------------+------------------------+-------------+--------------+-------------------+
| idx_actor_age | Valid | Normal | /default_schema | movie | Node | Actor | ["birthDate ASC"] |
| ft_movie | Valid | Fulltext | /default_schema | movie | Node | Movie | [name] |
| idx_watch_rating | Valid | Normal | /default_schema | movie | Edge | Watch | ["rate DESC"] |
| idx_gnode_g | Valid | Spatial(max_level=30, max_cells=8) | /default_schema | my_graph | Node | Person | [any_geo] |
| idx_node_vec1 | Valid | Vector{type:IVF, metric:L2, dimension:3, nlist:10, trainSize:4} | /default_schema | ann_test_graph | Node | N1 | [vec1] |
| idx_actor_age_temp | Valid | Normal | /default_schema | #movie_temporary_graph | Node | Actor | ["birthDate ASC"] |
| idx_watch_rating_temp | Valid | Normal | /default_schema | #movie_temporary_graph | Edge | Watch | ["rate DESC"] |
+-----------------------+-------+------------------------------------------------------------------------+-----------------+------------------------+-------------+--------------+-------------------+