dw-performance-optimization · git:20260523.e3316fc · 2026-05-23 · sha256 a98b7daa16fe5c06

dw-performance-optimization git:20260523.e3316fcA

Immutable. This exact content never changes and is served at /api/v1/blob/a98b7daa16fe5c06.

No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_c6juosp6nknhmimu/a98b7daa16fe5c068efef64f44e622f3b67e3bc426b61cd06d94361af71c8824.json

Then /plugin install dw-performance-optimization@markdownregistry-c6juosp6nknhmimu in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.

---
name: dw-performance-optimization
description: 数仓性能优化流程,适用于分析 ETL SQL 执行计划、分区裁剪、JOIN 策略、数据倾斜和资源瓶颈。直接调用命令:/dw-performance-optimization。
---

# Step 7: 性能优化

## 执行流程

1. 调用 `dw-explorer` subagent 分析表结构和血缘(防止撑爆主 context)
2. 检查 SQL 执行计划和性能瓶颈
3. 输出优化建议

## 检查维度

### SQL 层面
- 是否存在全表扫描
- JOIN 是否合理(小表驱动大表)
- WHERE 条件是否使用分区裁剪
- 是否存在数据倾斜
- GROUP BY / DISTINCT 是否可优化

### 存储层面
- 分区策略是否合理
- 文件大小是否均匀
- 是否存在小文件过多

### 资源层面
- 资源分配是否合理
- 是否可以增加并行度

## 推荐提示词

```
对 [表名] 的 ETL SQL 进行性能分析:
1. 用 dw-explorer 分析表结构和上下游血缘
2. 检查 insert_[表名].sql 的执行计划
3. 给出优化建议
```

## 输出格式

```markdown
## 性能分析报告

### 当前瓶颈
- [瓶颈 1]
- [瓶颈 2]

### 优化建议
| # | 优化项 | 预期提升 | 改动难度 |
|---|--------|---------|---------|
| 1 | ...    | ...     | ...     |

### 优化后 SQL
[优化后的 SQL 语句]
```