STATEMENT_HISTORY
获得当前节点的执行语句的信息。查询视图必须具有sysadmin权限或者monitor admin权限。只可在系统库中查询到结果,用户库中无法查询。
| 
       名称  | 
     
       类型  | 
     
       描述  | 
    
|---|---|---|
| 
       dbname  | 
     
       name  | 
     
       数据库名称。  | 
    
| 
       schemaname  | 
     
       name  | 
     
       schema名称。  | 
    
| 
       origin_node  | 
     
       integer  | 
     
       节点名称。  | 
    
| 
       user_name  | 
     
       name  | 
     
       用户名。  | 
    
| 
       application_name  | 
     
       text  | 
     
       用户发起的请求的应用程序名称。  | 
    
| 
       client_addr  | 
     
       text  | 
     
       用户发起的请求的客户端地址。  | 
    
| 
       client_port  | 
     
       integer  | 
     
       用户发起的请求的客户端端口。  | 
    
| 
       unique_query_id  | 
     
       bigint  | 
     
       归一化SQL ID。  | 
    
| 
       debug_query_id  | 
     
       bigint  | 
     
       唯一SQL ID。  | 
    
| 
       query  | 
     
       text  | 
     
       归一化SQL。  | 
    
| 
       start_time  | 
     
       timestamp with time zone  | 
     
       语句启动的时间。  | 
    
| 
       finish_time  | 
     
       timestamp with time zone  | 
     
       语句结束的时间。  | 
    
| 
       slow_sql_threshold  | 
     
       bigint  | 
     
       语句执行时慢SQL的标准。  | 
    
| 
       transaction_id  | 
     
       bigint  | 
     
       事务ID。  | 
    
| 
       thread_id  | 
     
       bigint  | 
     
       执行线程ID。  | 
    
| 
       session_id  | 
     
       bigint  | 
     
       用户session id。  | 
    
| 
       n_soft_parse  | 
     
       bigint  | 
     
       软解析次数,n_soft_parse + n_hard_parse可能大于n_calls,因为子查询未计入n_calls。  | 
    
| 
       n_hard_parse  | 
     
       bigint  | 
     
       硬解析次数,n_soft_parse + n_hard_parse可能大于n_calls,因为子查询未计入n_calls。  | 
    
| 
       query_plan  | 
     
       text  | 
     
       语句执行计划。  | 
    
| 
       n_returned_rows  | 
     
       bigint  | 
     
       SELECT返回的结果集行数。  | 
    
| 
       n_tuples_fetched  | 
     
       bigint  | 
     
       随机扫描行。  | 
    
| 
       n_tuples_returned  | 
     
       bigint  | 
     
       顺序扫描行。  | 
    
| 
       n_tuples_inserted  | 
     
       bigint  | 
     
       插入行。  | 
    
| 
       n_tuples_updated  | 
     
       bigint  | 
     
       更新行。  | 
    
| 
       n_tuples_deleted  | 
     
       bigint  | 
     
       删除行。  | 
    
| 
       n_blocks_fetched  | 
     
       bigint  | 
     
       buffer的块访问次数。  | 
    
| 
       n_blocks_hit  | 
     
       bigint  | 
     
       buffer的块命中次数。  | 
    
| 
       db_time  | 
     
       bigint  | 
     
       有效的DB时间花费,多线程将累加(单位:微秒)。  | 
    
| 
       cpu_time  | 
     
       bigint  | 
     
       CPU消耗时间(单位:微秒)。  | 
    
| 
       execution_time  | 
     
       bigint  | 
     
       执行器内执行时间(单位:微秒)。  | 
    
| 
       parse_time  | 
     
       bigint  | 
     
       SQL解析时间(单位:微秒)。  | 
    
| 
       plan_time  | 
     
       bigint  | 
     
       SQL生成计划时间(单位:微秒)。  | 
    
| 
       rewrite_time  | 
     
       bigint  | 
     
       SQL重写时间(单位:微秒)。  | 
    
| 
       pl_execution_time  | 
     
       bigint  | 
     
       plpgsql上的执行时间(单位:微秒)。  | 
    
| 
       pl_compilation_time  | 
     
       bigint  | 
     
       plpgsql上的编译时间(单位:微秒)。  | 
    
| 
       data_io_time  | 
     
       bigint  | 
     
       I/O上的时间花费(单位:微秒)。  | 
    
| 
       net_send_info  | 
     
       text  | 
     
       通过物理连接发送消息的网络状态,包含时间(微秒)、调用次数、吞吐量(字节)。单机模式下不支持该字段。  | 
    
| 
       net_recv_info  | 
     
       text  | 
     
       通过物理连接接收消息的网络状态,包含时间(微秒)、调用次数、吞吐量(字节)。单机模式下不支持该字段。  | 
    
| 
       net_stream_send_info  | 
     
       text  | 
     
       通过逻辑连接发送消息的网络状态,包含时间(微秒)、调用次数、吞吐量(字节)。单机模式下不支持该字段。  | 
    
| 
       net_stream_recv_info  | 
     
       text  | 
     
       通过逻辑连接接收消息的网络状态,包含时间(微秒)、调用次数、吞吐量(字节)。单机模式下不支持该字段。  | 
    
| 
       lock_count  | 
     
       bigint  | 
     
       加锁次数。  | 
    
| 
       lock_time  | 
     
       bigint  | 
     
       加锁耗时。  | 
    
| 
       lock_wait_count  | 
     
       bigint  | 
     
       加锁等待次数。  | 
    
| 
       lock_wait_time  | 
     
       bigint  | 
     
       加锁等待耗时。  | 
    
| 
       lock_max_count  | 
     
       bigint  | 
     
       最大持锁数量。  | 
    
| 
       lwlock_count  | 
     
       bigint  | 
     
       轻量级加锁次数(预留)。  | 
    
| 
       lwlock_wait_count  | 
     
       bigint  | 
     
       轻量级等锁次数。  | 
    
| 
       lwlock_time  | 
     
       bigint  | 
     
       轻量级加锁时间(预留)。  | 
    
| 
       lwlock_wait_time  | 
     
       bigint  | 
     
       轻量级加锁时间。  | 
    
| 
       details  | 
     
       bytea  | 
     
       语句锁事件的列表,该列表按时间顺序记录事件,记录的数量受参数track_stmt_details_size的影响。 事件包括: 
  | 
    
| 
       is_slow_sql  | 
     
       boolean  | 
     
       该SQL是否为slow SQL。  | 
    
| 
       trace_id  | 
     
       text  | 
     
       驱动传入的trace id,与应用的一次请求相关联。  | 
    
| 
       advise  | 
     
       text  | 
     
       可能导致该SQL为slow SQL的风险信息(可能同时存在多种风险)。 
  |