SHOW STATS command¶
The SHOW STATS command shows the statistics about a specific graph or a 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.
The following table describes the returned columns:
| Column | Description |
|---|---|
entry_name |
The name of the entry, which can be Edge Total, Node Total, or the name of the node or edge type. |
element_type |
The type of the element, which can be Node or Edge. |
total_num |
The first two counts represent the total number of nodes and edges in either the specified graph or the temporary graph. The remaining counts indicate the number of nodes or edges for each specified type respectively. |
The statistics also include the following information:
- The number of nodes in the specific graph or a temporary graph.
- The number of edges in the specific graph or a temporary graph.
- The number of nodes of each node type.
- The number of edges of each edge type.
Note
An operation involving a non-default schema or an object in it requires access to the schema, either implicitly or through an explicit USAGE grant, as well as the privilege required for the operation. The schema access check and the privilege check for the requested operation are independent; satisfying one does not satisfy the other. Schema access control does not apply to temporary graphs or built-in procedures and functions. For more information, see Schema access control.
Prerequisites¶
- To obtain statistics for a specified graph, you need to submit a job first.
- To obtain statistics for a temporary graph, you need to create a temporary graph first. For more information, see CREATE TEMPORARY GRAPH.
Syntax¶
- show_stats_command
show_stats_command ::=
'SHOW' 'STATS'
Examples¶
The following examples are based on the example dataset.
Show statistics of a specified graph¶
-
Submit a job to generate statistics for the
moviegraph.SUBMIT JOB STATS movieReturn:
+--------+ | job_id | +--------+ | 1 | +--------+ -
Make sure the job is complete.
SHOW JOB 1Return:
+---------+----------------+------------+-----------------------------+-----------------------------+ | task_id | state | service_id | dispatch_time | end_time | +---------+----------------+------------+-----------------------------+-----------------------------+ | 1 | TASK_SUCCEEDED | 2 | 2025-09-15T08:21:10.961000Z | 2025-09-15T08:21:10.968000Z | +---------+----------------+------------+-----------------------------+-----------------------------+When the status is
TASK_SUCCEEDED, the job is complete. For more information, see SHOW JOB. -
Show the statistics for the
moviegraph.USE movie SHOW STATSReturn:
+------------+--------------+-----------+ | entry_name | element_type | total_num | +------------+--------------+-----------+ | Node Total | Node | 4589 | | Edge Total | Edge | 10175 | | Actor | Node | 3312 | | Director | Node | 183 | | User | Node | 569 | | Movie | Node | 245 | | Genre | Node | 280 | | Act | Edge | 3732 | | Direct | Edge | 249 | | Watch | Edge | 3910 | | WithGenre | Edge | 2284 | +------------+--------------+-----------+
Show statistics of a temporary graph¶
'''
// Create a temporary graph
CREATE TEMPORARY GRAPH IF NOT EXISTS #movie_temporary_graph AS COPY OF movie
// Show statistics of the temporary graph
USE #movie_temporary_graph SHOW STATS
'''
Return:
+------------+--------------+-----------+
| entry_name | element_type | total_num |
+------------+--------------+-----------+
| Node Total | Node | 4589 |
| Edge Total | Edge | 10175 |
| Actor | Node | 3312 |
| Director | Node | 183 |
| User | Node | 569 |
| Movie | Node | 245 |
| Genre | Node | 280 |
| Act | Edge | 3732 |
| Direct | Edge | 249 |
| Watch | Edge | 3910 |
| WithGenre | Edge | 2284 |
+------------+--------------+-----------+