# alibabacloud-polardbx-sql

alibabacloud-polardbx-sql — a skill for writing SQL on distributed PolarDB-X 2.0 Enterprise Edition databases in AUTO mode, designing partition schemes, and avoiding MySQL incompatibilities.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 180 installs · ★ 300 repo stars
- Author: aliyun
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/aliyun/alibabacloud-aiops-skills/tree/HEAD/skills/database/drds/alibabacloud-polardbx-sql/SKILL.md
- Updated: 2026-10-23
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/alibabacloud-polardbx-sql

## What it does

This skill targets PolarDB-X 2.0 Enterprise Edition in AUTO mode, where tables use standard `PARTITION BY` syntax. If your database runs DRDS mode or Standard Edition, the skill refuses and directs you to the right tool.

The skill provides logic to select partition keys by analyzing query frequency, cardinality, and hotspot risk; create global indexes (GSI and CCI); convert single-node tables to partitioned ones; and handle Sequence, table groups, and TTL. It teaches how to write queries that avoid full-cluster scans and handles pagination via Keyset.

Before any operation, the skill requires explicit confirmation of connection parameters: host, port, user, password, and database name. Commands do not execute without approval.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-polardbx-sql -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/alibabacloud-polardbx-sql/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/alibabacloud-polardbx-sql/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-polardbx-sql -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/alibabacloud-polardbx-sql/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-polardbx-sql -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/alibabacloud-polardbx-sql/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install aliyun/alibabacloud-aiops-skills skills/database/drds/alibabacloud-polardbx-sql
```

2. **Manually: put the files in place**
- File: `.github/skills/alibabacloud-polardbx-sql/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-polardbx-sql -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/aliyun/alibabacloud-aiops-skills --path skills/database/drds/alibabacloud-polardbx-sql
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/alibabacloud-polardbx-sql/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-polardbx-sql -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/aliyun/alibabacloud-aiops-skills/tree/HEAD/skills/database/drds/alibabacloud-polardbx-sql/SKILL.md

## When to use it
- Design a partition scheme for a large table so queries hit one or a few shards instead of scanning the entire cluster
- Choose a partition key from multiple candidates by analyzing SQL patterns and data distribution
- Convert a MySQL table to a PolarDB-X partitioned table without data loss
- Create a global index (GSI or CCI) to speed up queries on non-partition-key fields
- Diagnose slow queries and understand why they trigger full-cluster scans

## Example prompts
- Help me pick the right partition key for an `orders` table based on its query patterns
- Write SQL to convert my single `users` table to a partitioned table sharded by `region_id` in AUTO mode
- Why does a query on `created_at` in the `products` table scan all shards, and how do I speed it up with GSI?

## Similar
- [bigquery-optimization](https://affpapa.org/en/nevibecode/skills/bigquery-optimization.md) — skill · 1400 installs
- [cockroachdb-expert](https://affpapa.org/en/nevibecode/agents/cockroachdb-expert.md) — subagent · ★ 1029 repo stars
- [database-optimizer](https://affpapa.org/en/nevibecode/agents/rohitg00-database-optimizer.md) — subagent · ★ 2858 repo stars
- [sql-optimization-patterns](https://affpapa.org/en/nevibecode/skills/sql-optimization-patterns.md) — skill · 19717 installs
- [sql-optimization](https://affpapa.org/en/nevibecode/skills/sql-optimization.md) — skill · 15701 installs
- [sql-code-review](https://affpapa.org/en/nevibecode/skills/sql-code-review.md) — skill · 14060 installs

From the same set: [aliyun/alibabacloud-aiops-skills](https://affpapa.org/en/nevibecode/by/aliyun/alibabacloud-aiops-skills.md) — 66 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
