# GS_ASP
GS_ASP显示被持久化的ACTIVE SESSION PROFILE样本。该系统表只能在系统库中查询。
表1GS_ASP字段 
| 名称                | 类型                       | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|
| sampleid                                                   | bigint                                                             | 采样ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| sample_time                                                    | timestamp with time zone                                            | 采样的时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| need_flush_sample | boolean                  | 该样本是否需要刷新到磁盘。 - t（true）：表示需要。  - f（false）：表示不需要。                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| databaseid        | oid                      | 数据库ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| thread_id         | bigint                   | 线程的ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| sessionid                                                   | bigint                   | 会话的ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| start_time        | timestamp with time zone | 会话的启动时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| event                                                        | text                                                                | 具体的事件名称。内核中关键的事件信息请参见[表2](https://support.huaweicloud.com/distributed-ref-v10-gaussdb/gaussdb-08-1362.html#ZH-CN_TOPIC_0000002764468482__zh-cn_topic_0059777957_t794f802302c24514a5db22d51eabacc4)、[表3](https://support.huaweicloud.com/distributed-ref-v10-gaussdb/gaussdb-08-1362.html#ZH-CN_TOPIC_0000002764468482__table38811324183420)、[表4](https://support.huaweicloud.com/distributed-ref-v10-gaussdb/gaussdb-08-1362.html#ZH-CN_TOPIC_0000002764468482__table124603113369)和[表5](https://support.huaweicloud.com/distributed-ref-v10-gaussdb/gaussdb-08-1362.html#ZH-CN_TOPIC_0000002764468482__table11826123533718)。关于每种事务锁对业务的影响程度，请参见[LOCK](https://support.huaweicloud.com/distributed-ref-v10-gaussdb/gaussdb-08-0353.html)语法小节的详细描述。                                                        |
| lwtid                                                         | integer                                                             | 当前线程的轻量级线程号。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| psessionid                                                     | bigint                                                               | streaming线程的父线程。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| tlevel                                                        | integer                                                            | streaming线程的层级。与执行计划的层级(ID)相对应。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| smpid                                                       | integer                                                            | smp执行模式下并行线程的并行编号。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| userid                                                     | oid                                                              | session用户的ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| application_name                                            | text                                                               | 应用的名字。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| client_addr                                                  | inet                                                                  | client端的地址。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| client_hostname                                              | text                                                              | client端的名字。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| client_port                                                 | integer                                                             | 客户端用于与后端通讯的TCP端口号。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| query_id                                                     | bigint                                                             | 唯一SQL id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| unique_query_id                                             | bigint                                                            | 归一化SQL id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| user_id                                                     | oid                                                                  | unique query的key中的user_id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| cn_id                                                      | integer                                                            | 表示该unique sql来自哪一个CN节点。unique query的key中的cn_id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| unique_query                                                | text                                                                 | 规范化后的Unique SQL文本串。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| locktag                                                     | text                                                               | 会话等待锁信息，可通过locktag_decode解析。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| lockmode                                                      | text                                                               | 会话等待锁模式： - LW_EXCLUSIVE：排他锁。  - LW_SHARED：共享锁。  - LW_WAIT_UNTIL_FREE：等待LW_EXCLUSIVE可用。                                                                                                                                                                                                                                                                                                                                                                     |
| block_sessionid                                              | bigint                                                                | 如果会话正在等待锁，阻塞该会话获取锁的会话标识。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| wait_status                                                  | text                                                                | 描述event列的更多详细信息。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| global_sessionid                                              | text                                                                 | 全局会话ID，结构为：nodeid：sessionid#seqid。 - nodeid：表示下发节点的ID。  - sessionid：表示下发节点，会话的ID。  - seqid：递增序列号，在下发节点上该ID为0。同一个会话下发到其他节点的会话，该字段的nodeid和sessionid相同。                                                                                                                                                                                                                                                                                                |
| xact_start_time                                             | timestamp with time zone                                           | 事务开始时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| query_start_time                                               | timestamp with time zone                                             | 语句开始执行时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| state                                                       | text                                                                 | 当前语句状态。 可能取值为： - active：后台正在执行一个查询。  - idle in transaction：后台在事务中，但事务中没有语句在执行。  - idle in transaction (aborted)：后台在事务中，但事务中有语句执行失败。  - fastpath function call：后台正在执行一个fast-path函数。  - disabled：如果后台禁用track_activities，则报告这个状态。   |
| event_start_time                                             | timestamp with time zone                                          | wait event的开始时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| current_xid                                                | xid                                                                 | 当前事务的ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| top_xid                                                     | xid                                                                | 当前执行事务的顶层事务ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| instance_name                                              | text                                                               | 指定该条记录所属CN或DN。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| parent_unique_sql_id                                          | bigint                                                              | 调用本条语句的父语句sql_id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| control_status                                             | text                                                               | 当进行异常SQL CPU资源管控时为under_cpu_throttle，否则为normal。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| top_unique_query_id                                        | bigint                                                              | 该字段展示存储过程顶层SQL的unique_query_id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| top_unique_query                                            | text                                                                | 该字段展示存储过程顶层SQL的unique_query语句。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| sql_hash                                                     | bigint                                                            | 当前SQL语句对应的hash值，为0。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| plan_hash                                                  | bigint                                                              | 当前SQL语句执行计划对应的hash值，为0。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
   
