STATEMENT_HISTORY
Displays information about statements executed on the current node. The result can be queried only in the system database but cannot be queried in the user database.
Name |
Type |
Description |
---|---|---|
dbname |
name |
Database name. |
schemaname |
name |
Schema name. |
origin_node |
integer |
Node name. |
user_name |
name |
Username. |
application_name |
text |
Name of the application that sends a request. |
client_addr |
text |
IP address of the client that sends a request. |
client_port |
integer |
Port number of the client that sends a request. |
unique_query_id |
bigint |
ID of the normalized SQL statement. |
debug_query_id |
bigint |
ID of the unique SQL statement. |
query |
text |
Normalized SQL (available only on CNs). |
start_time |
timestamp with time zone |
Time when a statement starts. |
finish_time |
timestamp with time zone |
Time when a statement ends. |
slow_sql_threshold |
bigint |
Standard for slow SQL statement execution. |
transaction_id |
bigint |
Transaction ID. |
thread_id |
bigint |
ID of an execution thread. |
session_id |
bigint |
Session ID of a user. |
n_soft_parse |
bigint |
Number of soft parsing times. The value of n_soft_parse plus the value of n_hard_parse may be greater than the value of n_calls because the number of subqueries is not counted in the value of n_calls. |
n_hard_parse |
bigint |
Number of hard parsing times. The value of n_soft_parse plus the value of n_hard_parse may be greater than the value of n_calls because the number of subqueries is not counted in the value of n_calls. |
query_plan |
text |
Statement execution plan. |
n_returned_rows |
bigint |
Number of rows in the result set returned by the SELECT statement. |
n_tuples_fetched |
bigint |
Number of rows randomly scanned. |
n_tuples_returned |
bigint |
Number of rows sequentially scanned. |
n_tuples_inserted |
bigint |
Number of rows inserted. |
n_tuples_updated |
bigint |
Number of rows updated. |
n_tuples_deleted |
bigint |
Number of rows deleted. |
n_blocks_fetched |
bigint |
Number of buffer block access times. |
n_blocks_hit |
bigint |
Number of buffer block hits. |
db_time |
bigint |
Valid DB time, which is accumulated if multiple threads are involved (unit: μs) |
cpu_time |
bigint |
CPU time (unit: μs). |
execution_time |
bigint |
Execution time in the executor (unit: μs). |
parse_time |
bigint |
SQL parsing time (unit: μs) |
plan_time |
bigint |
SQL plan generation time (unit: μs). |
rewrite_time |
bigint |
SQL rewriting time (unit: μs). |
pl_execution_time |
bigint |
Execution time of PL/pgSQL (unit: μs). |
pl_compilation_time |
bigint |
Compilation time of PL/pgSQL (unit: μs) |
data_io_time |
bigint |
I/O time (unit: μs). |
net_send_info |
text |
Network status of messages sent through a physical connection, including the time (unit: μs), number of calls, and throughput (unit: byte). In a distributed database, CNs communicate with each other, CNs communicate with customer service ends, and CNs communicate with DNs through physical connections. This column can be used to analyze the network overhead of SQL statements in a distributed system. Example: {"time":xxx, "n_calls":xxx, "size":xxx}. |
net_recv_info |
text |
Network status of messages received through a physical connection, including the time (unit: μs), number of calls, and throughput (unit: byte). In a distributed database, CNs communicate with each other, CNs communicate with customer service ends, and CNs communicate with DNs through physical connections. This column can be used to analyze the network overhead of SQL statements in a distributed system. Example: {"time":xxx, "n_calls":xxx, "size":xxx}. |
net_stream_send_info |
text |
Network status of messages sent through a logical connection, including the time (unit: μs), number of calls, and throughput (unit: byte). In a distributed database, DNs of different shards communicate with each other through logical connections. This column can be used to analyze the network overhead of SQL statements in a distributed system. Example: {"time":xxx, "n_calls":xxx, "size":xxx}. |
net_stream_recv_info |
text |
Network status of messages received through a logical connection, including the time (unit: μs), number of calls, and throughput (unit: byte). In a distributed database, DNs of different shards communicate with each other through logical connections. This column can be used to analyze the network overhead of SQL statements in a distributed system. Example: {"time":xxx, "n_calls":xxx, "size":xxx}. |
lock_count |
bigint |
Number of locks. |
lock_time |
bigint |
Time required for locking. |
lock_wait_count |
bigint |
Number of lock waits. |
lock_wait_time |
bigint |
Time required for lock waiting. |
lock_max_count |
bigint |
Maximum number of locks. |
lwlock_count |
bigint |
Number of lightweight locks (reserved). |
lwlock_wait_count |
bigint |
Number of lightweight lock waits. |
lwlock_time |
bigint |
Time required for lightweight locking (reserved). |
lwlock_wait_time |
bigint |
Time required for lightweight lock waiting. |
details |
bytea |
List of wait events and statement lock events. When the value of track_stmt_stat_level is greater than or equal to L0, the list of wait events starts to be recorded. It displays statistics about wait events on the current node. For key events in the kernel, see Table 2. Alternatively, view the list of all events in the system in the wait_event_info view. For details about the impact of each transaction lock on services, see LOCK. When the value of track_stmt_stat_level is L2, the list of statement lock events is recorded. The list records events in chronological order. The number of records is affected by the value of the track_stmt_details_size parameter. This field is in binary format and needs to be read by using the parsing function pg_catalog.statement_detail_decode. For details, see Other Functions. Events include:
|
is_slow_sql |
boolean |
Whether the SQL statement is a slow SQL statement. |
trace_id |
text |
Driver-specific trace ID, which is associated with an application request. |
advise |
text |
Risk information that may cause the SQL statement to be a slow SQL statement. |
parent_unique_sql_id |
bigint |
Normalized SQL ID of the outer SQL statement. For statements executed in a stored procedure, the value is the normalized SQL ID of the statement that invokes the stored procedure. For statements outside the stored procedure, the value is 0. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot