
# 查询历史等待事件 - ListHistoryWaitEvents
#### 功能介绍
查询历史等待事件。
- 调用接口前，您需要了解API[认证鉴权](https://support.huaweicloud.com/api-rds/rds_03_0001.html)。
- 调用接口前，您需要了解[请求Header参数说明](https://support.huaweicloud.com/api-rds/rds_03_0005.html#rds_03_0005__section479119143310)。
 
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?product=RDS&api=ListHistoryWaitEvents)中调试该接口。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-rds/rds_10_0005.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
 
| 授权项                       | 访问级别 | 资源类型（\*为必须） | 条件键                                                                          | 别名 | 依赖的授权项 |
|:---|:---|:---|:---|:---|:---|
| rds:instance:getWaitEvent | list | -           | g:EnterpriseProjectId g:ResourceTag/\<tag-key\> | -  | -      |
   
#### 接口约束
该接口仅支持RDS for PostgreSQL引擎。
#### URI
- URI格式 GET /v3/{project_id}/instances/{instance_id}/history-wait-event?start_time={start_time}\&end_time={end_time}
  
- 参数说明
  表1参数说明 
  | 参数          | 是否必选 | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
  |:---|:---|:---|
  | project_id  | 是    | **参数解释：** 租户在某一region下的project ID。 获取方法请参见[获取项目ID](https://support.huaweicloud.com/api-rds/rds_03_0002.html)。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。                                                                                 |
  | instance_id | 是    | **参数解释：** 实例ID。 可调用[查询数据库实例列表](https://support.huaweicloud.com/api-rds/rds_01_0004.html)接口，通过[表4](https://support.huaweicloud.com/api-rds/rds_01_0004.html#rds_01_0004__table2058713718267)中的"id"获取。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。 |
  | start_time  | 是    | **参数解释：** 开始时间。 **约束限制：** 格式为UTC时间戳。 **取值范围：** 不涉及。 **默认取值** **：** 不涉及。                                                                                                                                                                                                                                                                                                                               |
  | end_time    | 是    | **参数解释：** 结束时间。 **约束限制：** 格式为UTC时间戳。 **取值范围：** 不涉及。 **默认取值** **：** 不涉及。                                                                                                                                                                                                                                                                                                                      |
  | offset      | 否    | **参数解释：** 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,值为0表示从第一条数据开始查询)。 **约束限制：** 必须为数字,不能为负数。 **取值范围：** 大于等于0的整数。 **默认取值** **：** 0。                                                                                                                                                                                                                                                                      |
  | limit       | 否    | **参数解释：** 查询记录数。 **约束限制：** 不涉及。 **取值范围：** \[1, 1000\] **默认取值** **：** 100                                                                                                                                                                                                                                                                                                                      |
     
  
 
#### 请求消息
无。
#### 请求示例
查询历史等待事件。
```
GET https://{Endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/24c6678f474241fe89ee9c42f768022ein03/history-wait-event?start_time=1764669600000&end_time=1765249000000
```
#### 响应消息
- 正常响应要素说明
  表2要素说明 
  | 参数          | 参数类型             | 描述                                                                                                                                                                                                                   |
  |:---|:---|:---|
  | total_count | Integer          | **参数解释：** 总记录数。 **取值范围：** 不涉及。 |
  | events      | Array of objects | **参数解释：** 事件列表。 详情请参见[表3]。      |
     
   表3events字段说明 
  | 参数              | 参数类型    | 描述                                                                                                                                                                                                                       |
  |:---|:---|:---|
  | sample_time     | String  | **参数解释：** 采样时间。 **取值范围：** 不涉及。     |
  | count           | Integer | **参数解释：** 个数。 **取值范围：** 不涉及。       |
  | session_status  | String  | **参数解释：** 会话状态。 **取值范围：** 不涉及。    |
  | wait_event_type | String  | **参数解释：** 等待事件类型。 **取值范围：** 不涉及。   |
  | wait_event_name | String  | **参数解释：** 等待事件名称。 **取值范围：** 不涉及。 |
     
  
- 正常响应样例
  ```
  { 
    "events" : [ { 
      "sample_time" : "2025-12-02 18:03:27", 
      "count" : 1, 
      "session_status" : "", 
      "wait_event_type" : "", 
      "wait_event_name" : "" 
    } ], 
    "total_count" : 1 
  }
  ```
  
  
- 异常响应 请参见[异常响应结果](https://support.huaweicloud.com/api-rds/rds_01_0010.html)。
  
 
#### 状态码
- 正常 200
  
- 异常 请参见[状态码](https://support.huaweicloud.com/api-rds/rds_10_0200.html)。
  
 
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-rds/rds_10_0201.html)。
