---
schema_version: "1"
id: 4783ddcf0518f90483845c8aede6a58ea2773a7ff28ab4eb3d478a7336fd7e6c
title: 查询缓慢
collection: tableau
version: current
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/current/zh-cn/server/rmt-incidents-slow-query.md
canonical_url: https://help.tableau.com/current/server/zh-cn/rmt-incidents-slow-query.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 8f69cac5b67495477684778e6c44e1614f80d7517ecc71e53025d43190089b6d
description: Understand and configure slow query incidents in the Resource Monitoring Tool.
---
[跳转到主要内容](#main-content)

# 查询缓慢事件

当任何数据查询完成所花费的时间太长时，将触发_查询缓慢_事件。默认情况下，如果任何数据查询的执行时间达到或超过 30，“查询速度慢”事件将触发警告。

您可以使用 RMT Server Web 界面或通过更新配置文件 `config.json` 来配置阈值。

若要为慢速查询事件设置阈值，请在**“管理”**菜单下选择 **“配置”**，然后转到“**事件**”选项卡。

<table style="width: 100%;" class="simple-table"><colgroup><col><col><col></colgroup><thead><tr><th>键</th><th>是否必需？</th><th>描述</th></tr></thead><tbody><tr><td><b>严重程度</b></td><td>必需</td><td><p>请参见<a href="https://help.tableau.com/current/server/zh-cn/rmt-incidents-index-incidents.htm#incident-severity-levels">事件严重程度级别</a>。</p></td></tr><tr><td><b>持续时间</b></td><td>必需</td><td>查询被视为缓慢的最短持续时间。值以秒为单位。</td></tr></tbody></table>

下面是一个定义“查询缓慢”事件的示例 `config.json` 代码片段：

```
{  
 "monitoring":  {  
    "incidents":  {  
      "triggers":  [  
        {  
          "counter":  "DataQueryDuration",  
          "severity":  "critical",  
          "threshold":  45000  
        }  
      ]  
    }  
  }  
}
```

如果数据查询的执行时间至少为 45 秒，则会触发“查询缓慢”事件。

可以按环境配置事件。例如，为了使其标识符为“staging-environment”的环境在数据查询的执行时间超过 30 秒时触发警告，则配置将类似于如下：

```
{  
  "environments":  {  
    "staging-environment":  {  
     "monitoring":  {  
       "incidents":  {  
          "triggers":  [  
            {  
              "counter":  "DataQueryDuration",  
              "severity":  "warning",  
              "threshold":  30000  
            }  
          ]  
        }  
      }  
    }  
  }  
}
```

| 键 | 数据类型 | 是否必需？ | 描述 |
| --- | --- | --- | --- |
| `counter` | 字符串 | 必需 | “查询缓慢”事件使用 `DataQueryDuration` 标识符。 |
| `severity` | 字符串 | 可选 | 请参见[事件严重程度级别](https://help.tableau.com/current/server/zh-cn/rmt-incidents-index-incidents.htm#incident-severity-levels)。默认值：`Warning` |
| `threshold` | 数字 | 必需 | 查询被视为缓慢的最短持续时间。值以毫秒为单位。 |

## 谁可以执行此操作

具有**服务器/环境管理**角色的Resource Monitoring Tool管理员或Resource Monitoring Tool用户。