detect_fragmented_tables
하는 일
이 스킬은 쓰이지 않는 공간을 안고 있는 MySQL과 MariaDB 테이블을 찾고, 되찾을 수 있는 용량을 추정합니다. 저장 공간 사용을 안전하게 줄이려는 데이터베이스 관리자를 위한 것입니다.
사용하는 경우
- ✓데이터베이스 디스크가 차고 있어서 낭비가 어디인지 알고 싶을 때.
- ✓테이블에 되찾을 수 있는 빈 공간이 많을 때.
- ✓유지 보수를 계획하면서 서버에 영향을 줄 만큼 큰 테이블을 알아야 할 때.
스킬 링크
https://github.com/major/MySQLTuner-perl/blob/master/.agent/skills/detect-fragmented-tables/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 데이터베이스에서 디스크 공간을 가장 많이 낭비하는 테이블을 찾고, 어떤 것을 안전하게 정리할 수 있는지 알려 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 테이블 크기 정보를 읽고, 각 테이블의 빈 공간 비율을 계산해 순위를 매깁니다. 정리 명령을 제안하고, 영향이 큰 큰 테이블은 고영향으로 표시해 계획을 세울 수 있게 합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
AI Skill: Table Fragmentation & Storage Reclaim Diagnostics
🧠 Purpose & Operational Objectives
The detect_fragmented_tables skill enables autonomous DBA agents to identify wasted disk space, high data file fragmentation, and unused allocated extents across InnoDB and MyISAM tables.
📋 Preconditions & Context
- Server running MySQL 5.5+ or MariaDB 10.0+.
- Read access to
information_schema.TABLES. - Evaluates non-system schemas (skips
mysql,information_schema,performance_schema,sys).
🛠️ Input Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
min_fragmentation_pct |
number | No | 20 |
Minimum fragmentation percentage (0-100) to trigger reporting. |
min_table_size_mb |
number | No | 10 |
Minimum table size in MB to filter out trivial tables. |
schema_filter |
string | No | "" |
Optional schema name to restrict the scan. |
📊 Fragmentation Formula & Impact Scoring
$$\text{Total Allocated Space} = \text{DATA_LENGTH} + \text{INDEX_LENGTH} + \text{DATA_FREE}$$ $$\text{Fragmentation Pct} = \left(\frac{\text{DATA_FREE}}{\text{Total Allocated Space}}\right) \times 100$$
- Tables $< 5\text{GB}$: Can be defragmented online during low-traffic windows via
OPTIMIZE TABLE \db`.`table`;`. - Tables $\ge 5\text{GB}$: Flagged as
is_high_impact: true. Advise using online tools likept-online-schema-changeorgh-ostto prevent extended table locks and disk thrashing.
🛡️ Guardrails & Safety
- All schema and table names are safely escaped with backticks to prevent SQL injection.
- Reclaimable disk space is calculated deterministically.
자주 묻는 질문
스스로 테이블을 정리하나요?
아니요. 보고하고 명령을 제안합니다. 데이터베이스에서 무엇이든 실행하기 전에 직접 검토하면 됩니다.
어떤 테이블은 제외하나요?
mysql, information_schema, performance_schema, sys 같은 시스템 스키마는 검사하지 않습니다.
검사 범위를 좁힐 수 있나요?
네. 최소 단편화 비율과 테이블 크기를 정하거나, 검사를 한 스키마로 제한할 수 있습니다.
상세 정보
작성자의 원본 설명
Detects tables with high storage fragmentation, calculates reclaimable disk space, evaluates lock impact, and generates safe defragmentation commands.
repo: major/MySQLTuner-perl
인기도
- GitHub 스타
- 9.5k
- 순위
- #12278
- 라이선스
- GPL-3.0
- 업데이트
- 2026. 10. 28.
댓글
- …
이 저장소의 다른 스킬
analyze_buffer_pool
9.5k에이전트가 MySQL 또는 MariaDB의 InnoDB 버퍼 풀 사용을 점검하고, 디스크 쓰기 지연을 찾아 적절한 크기를 제안하도록 돕습니다.
cli-execution-mastery
9.5k에이전트가 로컬, 원격, 컨테이너 데이터베이스에 맞는 연결과 로그인 옵션으로 MySQLTuner 상태 점검을 실행하도록 돕습니다.
diagnose_replication_lag
9.5k에이전트가 MySQL 또는 MariaDB 복제본이 원본 서버보다 뒤처졌는지 확인하고, 실패한 복제 스레드와 그 오류를 찾도록 돕습니다.
비슷한 스킬
discrawl
394k에이전트가 저장된 로컬 Discord 메시지 보관본을 검색하고 요약하며, 최신 상태를 확인하고 다이렉트 메시지를 읽도록 돕습니다.
clickhouse-io
280k에이전트가 ClickHouse 데이터베이스의 쿼리와 스키마를 최적화하도록 돕습니다. 고성능 분석 작업의 모범 사례를 적용합니다. 분석 쿼리가 느릴 때 씁니다.
scientific-db-pubmed-database
280k생의학 분야의 과학 논문을 에이전트가 검색하도록 돕습니다. 특정 의학 정보가 필요한 연구에 유용합니다.