---
name: "tidb-distributed-htap-mysql-scale"
description: "Scale relational MySQL workloads horizontally with distributed ACID transactions using TiDB."
metadata:
  author: "PingCAP"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "scale mysql with tidb"
  - "configure tiflash replica"
  - "execute htap query tidb"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# TiDB Distributed HTAP MySQL-Compatible Scaling

Operates TiDB distributed databases: deploying TiDB, TiKV (row-based transactional engine), and TiFlash (columnar analytical engine), partitioning large tables, and executing real-time HTAP queries.

## When to Invoke
Invoke this skill whenever you need to:
- scale mysql with tidb
- configure tiflash replica
- execute htap query tidb

## Execution SOP & Rules
1. Connect using standard MySQL 8 client drivers specifying TiDB cluster port 4000.
2. Enable columnar replica: ALTER TABLE orders SET TIFLASH REPLICA 1; and monitor replica status.
3. Run EXPLAIN ANALYZE to verify query optimizer chose TiFlash columnar scan for aggregation queries.
4. Manage auto-sharding regions and placement rules via TiDB Dashboard and PD control CLI.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
