lab_code: demo_008
title_en: Managing Runaway Queries (v8.5+)
title_zh: 管理 Runaway Queries (v8.5+)
title_ja: ランナウェイクエリの管理 (v8.5+)
title_ko: "Runaway Queries 관리 (v8.5+)"
description_en: In this lab, we show you how to identify and manage queries that consume more resources than expected (runaway queries), as well as monitor potential runaway queries. TiDB provides the capability to manage the runaway queries in the resource control feature. You can set criteria for a resource group to identify runaway queries and automatically take actions to prevent them from exhausting resources and affecting other queries. Furthermore, you can also use runaway watches to quickly identify runaway queries for a given SQL statement or digest.
description_zh: 在本实验中，我们将向您展示如何识别和管理资源消耗超出预期的查询（Runaway Queries），以及如何监控潜在的 Runaway Queries。TiDB 在资源管控功能中提供了管理 Runaway Queries 的能力。您可以为资源组设置识别 Runaway Queries 的标准，并自动采取措施防止其耗尽资源、影响其他查询。此外，您还可以使用 Runaway Watches 快速识别特定 SQL 语句或 digest 的 Runaway Queries。
description_ja: このラボでは、予想以上にリソースを消費するクエリ（ランナウェイクエリ）を識別および管理する方法、そして潜在的なランナウェイクエリを監視する方法を紹介します。TiDBのリソースコントロール機能では、ランナウェイクエリを管理することができます。リソースグループごとにランナウェイクエリを識別する基準を設定し、自動的にリソースの枯渇や他のクエリへの影響を防ぐアクションを実行できます。さらに、Runaway Watchesを利用して特定のSQL文やダイジェストに対するランナウェイクエリを素早く特定することも可能です。
description_ko: 이 실습에서는 예기치 않은 리소스 소모 쿼리 (Runaway Queries)를 식별하고 관리하는 방법과 잠재적인 Runaway Queries를 모니터링하는 방법을 보여드립니다. TiDB는 리소스 제어 기능에서 Runaway Queries를 관리할 수 있는 기능을 제공합니다. 리소스 그룹에 대한 기준을 설정하여 Runaway Queries를 식별하고, 리소스 소모를 방지하고 다른 쿼리에 영향을 주는 자동 조치를 취할 수 있습니다. 또한, 특정 SQL 문 또는 digest에 대한 Runaway Queries를 빠르게 식별하기 위해 "Runaway Watch"를 사용할 수도 있습니다.
splash_image_en: https://lab-static.pingcap.com/images/2025/9/8/937182d13d889b3b45b04561918b56de4130c3df.png
splash_image_zh: https://lab-static.pingcap.com/images/2025/9/8/937182d13d889b3b45b04561918b56de4130c3df.png
splash_image_ja: https://lab-static.pingcap.com/images/2025/9/8/937182d13d889b3b45b04561918b56de4130c3df.png
splash_image_ko: https://lab-static.pingcap.com/images/2025/9/8/937182d13d889b3b45b04561918b56de4130c3df.png
external_materials_en:
  - name: "Runaway Queries Deck Template"
    url: https://docs.google.com/presentation/d/13unHWCO_Ys_pMe-22HP_6vz6tKVj0Run/edit?slide=id.p1#slide=id.p1
    employee_only: true
external_materials_ja:
  - name: "ランナウェイクエリデッキテンプレート"
    url: https://docs.google.com/presentation/d/13unHWCO_Ys_pMe-22HP_6vz6tKVj0Run/edit?slide=id.p1#slide=id.p1
    employee_only: true
external_materials_zh:
  - name: "Runaway Queries 演示文稿模板"
    url: https://docs.google.com/presentation/d/13unHWCO_Ys_pMe-22HP_6vz6tKVj0Run/edit?slide=id.p1#slide=id.p1
    employee_only: true
external_materials_ko:
  - name: "Runaway Queries 자료 템플릿"
    url: https://docs.google.com/presentation/d/13unHWCO_Ys_pMe-22HP_6vz6tKVj0Run/edit?slide=id.p1#slide=id.p1
    employee_only: true
lab_level: Advanced
category_en:
  - Multi-Tenant
  - Resource Control
category_zh:
  - 多租户
  - 资源控制
category_ja:
  - マルチテナント
  - リソース制御
category_ko:
  - 멀티테넌트
  - 리소스 제어
authors:
  - Tony Huang (CEG)
  - Fei Dong (CEG)
delivery_type: Self-Paced
tidb_environments:
  - TiDB Self-Managed
tidb_versions:
  - "8.5.1"
target_audience:
  - Architect
  - DBA
  - DevOps
regions:
  aws:
    - oregon
    - tokyo
    - singapore
    - frankfurt
credits: 5
credit_redeemable: true
employee_only: false
estimated_duration_minutes: 90

topology:
  - role: monitor
    node_count: 1
    ssh_user: ec2-user
    web_ssh: true
    web_ssh_name: "TiUP Control Machine"
  - role: pd
    node_count: 3
  - role: kv
    node_count: 3
  - role: db
    node_count: 2

requirements:
  - type: CloudStack

bootstrap:
  - name: "prepare monitor"
    type: "ShellScript"
    target:
      - monitor1
    script: ./scripts/prepare-monitor.sh

features:
  enable_content_explain: false
