Nw Query Optimization
nWave-ai/nWave
SQL and NoSQL query optimization techniques, indexing strategies, execution plan analysis, JOIN algorithms, cardinality estimation, and database-specific query patterns
SQL/NoSQL 쿼리 최적화 패턴, 실행 계획 분석, 인덱스 전략, N+1 문제 해결 등 데이터베이스 성능 최적화 가이드.
$ npx skills add revfactory/harness-100 --skill query-optimization-patterns -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install revfactory/harness-100 query-optimization-patterns --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .claude/skills && cp -r skills-src/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns .claude/skills/query-optimization-patterns && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "query-optimization-patterns" agent skill from https://github.com/revfactory/harness-100/tree/main/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns into .claude/skills/query-optimization-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-patterns", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/revfactory/harness-100/tree/main/ko/29-performance-optimizer/.claude/skills/query-optimization-patternsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add revfactory/harness-100 --skill query-optimization-patterns -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install revfactory/harness-100 query-optimization-patterns --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .agents/skills && cp -r skills-src/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns .agents/skills/query-optimization-patterns && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "query-optimization-patterns" agent skill from https://github.com/revfactory/harness-100/tree/main/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns into .agents/skills/query-optimization-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-patterns", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add revfactory/harness-100 --skill query-optimization-patterns -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install revfactory/harness-100 query-optimization-patterns --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns .cursor/skills/query-optimization-patterns && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "query-optimization-patterns" agent skill from https://github.com/revfactory/harness-100/tree/main/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns into .cursor/skills/query-optimization-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-patterns", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/revfactory/harness-100.git --path ko/29-performance-optimizer/.claude/skills/query-optimization-patterns--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add revfactory/harness-100 --skill query-optimization-patterns -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install revfactory/harness-100 query-optimization-patterns --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns .gemini/skills/query-optimization-patterns && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "query-optimization-patterns" agent skill from https://github.com/revfactory/harness-100/tree/main/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns into .gemini/skills/query-optimization-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-patterns", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install revfactory/harness-100 query-optimization-patternsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add revfactory/harness-100 --skill query-optimization-patterns -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .github/skills && cp -r skills-src/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns .github/skills/query-optimization-patterns && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "query-optimization-patterns" agent skill from https://github.com/revfactory/harness-100/tree/main/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns into .github/skills/query-optimization-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-patterns", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add revfactory/harness-100 --skill query-optimization-patterns -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install revfactory/harness-100 query-optimization-patterns --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns .opencode/skills/query-optimization-patterns && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "query-optimization-patterns" agent skill from https://github.com/revfactory/harness-100/tree/main/ko/29-performance-optimizer/.claude/skills/query-optimization-patterns into .opencode/skills/query-optimization-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-patterns", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
query-optimization-patternsSQL/NoSQL 쿼리 최적화 패턴, 실행 계획 분석, 인덱스 전략, N+1 문제 해결 등 데이터베이스 성능 최적화 가이드.
Query Optimization Patterns is an agent skill from revfactory/harness-100. SQL/NoSQL 쿼리 최적화 패턴, 실행 계획 분석, 인덱스 전략, N+1 문제 해결 등 데이터베이스 성능 최적화 가이드. '쿼리 최적화', '실행 계획', 'EXPLAIN', '인덱스 설계', 'N+1 문제', '느린 쿼리', 'slow query', 'DB 성능' 등 데이터베이스 쿼리 성능 개선 시 이 스킬을 사용한다. bottleneck-analyst와 optimization-engineer의 DB 성능 분석 역량을 강화한다. 단, 전체 시스템 프로파일링이나 벤치마크 실행은 이 스킬의 범위가 아니다.
Its SKILL.md is about 1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Databases, covering Query optimization and NoSQL databases. It works with SQL. The licence is Apache-2.0.
Read from SKILL.md and the folder at commit 8e8d35c. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are sql and python).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Query Optimization Patterns loads about 1k tokens when it runs. Until then it costs about 79 tokens; SKILL.md has 302 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from revfactory/harness-100 at commit 8e8d35c, republished under its Apache-2.0 licence (© revfactory). 302 words, ~1,015 tokens.
.claude/skills/query-optimization-patterns/SKILL.md (or your agent's skills folder).데이터베이스 쿼리 성능을 체계적으로 분석하고 최적화하는 방법론.
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT o.*, c.name
FROM orders o
JOIN customers c ON o.customer_id = c.id
WHERE o.created_at > '2024-01-01'
ORDER BY o.total_amount DESC
LIMIT 10;| 지표 | 의미 | 위험 신호 |
|---|---|---|
| Seq Scan | 전체 테이블 스캔 | 큰 테이블에서 발생 시 |
| Nested Loop | 행 단위 조인 | 외부 테이블이 클 때 |
| Hash Join | 해시 기반 조인 | work_mem 초과 시 디스크 사용 |
| Sort | 정렬 | 메모리 초과 시 외부 정렬 |
| Bitmap Heap Scan | 인덱스 → 테이블 접근 | lossy 비트맵 시 성능 저하 |
| actual time | 실제 소요 시간 | 첫 행 vs 전체 행 차이 |
| rows | estimated vs actual 차이 | 10배 이상 차이 → 통계 갱신 |
❌ Seq Scan on large_table (rows=10000000)
→ 인덱스 추가 필요
❌ Sort Method: external merge (Disk: 256MB)
→ work_mem 증가 또는 인덱스 정렬
❌ Nested Loop (actual rows=1000000)
→ Hash Join 또는 Merge Join으로 전환
❌ estimated=100 actual=100000
→ ANALYZE 실행하여 통계 갱신| 인덱스 유형 | 적합한 경우 | 부적합한 경우 |
|---|---|---|
| B-Tree (기본) | 등호, 범위, 정렬 | 배열, JSON, 전문 검색 |
| Hash | 등호 비교만 | 범위 쿼리 |
| GIN | 배열, JSONB, 전문 검색 | 단순 등호/범위 |
| GiST | 지리공간, 범위 타입 | 단순 스칼라 |
| BRIN | 물리적으로 정렬된 데이터 | 랜덤 분포 |
-- 왼쪽 접두사 규칙 (Leftmost Prefix)
CREATE INDEX idx_orders ON orders(status, created_at, customer_id);
-- 이 인덱스가 커버하는 쿼리:
✅ WHERE status = 'PAID'
✅ WHERE status = 'PAID' AND created_at > '2024-01-01'
✅ WHERE status = 'PAID' AND created_at > '2024-01-01' AND customer_id = 123
❌ WHERE created_at > '2024-01-01' (status 누락)
❌ WHERE customer_id = 123 (status, created_at 누락)
-- 컬럼 순서 결정 기준:
-- 1. 등호 조건 컬럼 먼저 (선택도 높은 것)
-- 2. 범위 조건 컬럼 다음
-- 3. ORDER BY 컬럼 마지막-- 테이블 접근 없이 인덱스만으로 쿼리 완료
CREATE INDEX idx_covering ON orders(status, created_at) INCLUDE (total_amount);
SELECT total_amount FROM orders
WHERE status = 'PAID' AND created_at > '2024-01-01';
-- Index Only Scan 발생 → 힙 접근 불필요# N+1 패턴 (느림!)
orders = Order.objects.filter(status="PAID") # 쿼리 1
for order in orders:
print(order.customer.name) # 쿼리 N (주문 수만큼)
# 총 쿼리: 1 + N
# Eager Loading으로 해결
orders = Order.objects.filter(status="PAID").select_related("customer") # 쿼리 1 (JOIN)
# 또는
orders = Order.objects.filter(status="PAID").prefetch_related("items") # 쿼리 2 (IN)| ORM | N+1 해결 | 방법 |
|---|---|---|
| Django | select_related / prefetch_related | FK JOIN / Reverse IN |
| SQLAlchemy | joinedload / subqueryload | JOIN / 서브쿼리 |
| TypeORM | relations / @JoinColumn | eager/lazy 설정 |
| Prisma | include | 자동 배치 |
| JPA | @EntityGraph / JOIN FETCH | JPQL/Criteria |
| 방식 | SQL | 성능 | 적합 |
|---|---|---|---|
| OFFSET | LIMIT 20 OFFSET 10000 | O(N) — 느림 | 소규모, 초반 페이지 |
| Keyset | WHERE id > 1000 LIMIT 20 | O(1) — 빠름 | 대규모, 무한 스크롤 |
| Cursor | 암호화된 keyset | O(1) | API, 클라이언트용 |
-- OFFSET (10000번째부터 → 10000행 스캔 후 버림)
SELECT * FROM orders ORDER BY id LIMIT 20 OFFSET 10000;
-- Keyset (즉시 해당 위치로)
SELECT * FROM orders WHERE id > 10000 ORDER BY id LIMIT 20;| 안티패턴 | 문제 | 해결 |
|---|---|---|
SELECT * | 불필요한 컬럼 전송 | 필요한 컬럼만 명시 |
WHERE func(column) | 인덱스 사용 불가 | 변환을 상수 쪽으로 이동 |
LIKE '%keyword%' | 풀스캔 | 전문 검색 인덱스(GIN) |
| 서브쿼리 IN (대량) | 느린 실행 | JOIN으로 전환 |
| 암시적 타입 변환 | 인덱스 무효화 | 타입 일치 |
© revfactory, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in ko/29-performance-optimizer/.claude/skills/query-optimization-patterns of revfactory/harness-100.
Open the folder on GitHubat commit 8e8d35c
Query Optimization Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Query Optimization Patterns this skillrevfactory/harness-100 | 1.3k | — | ~1k | Automated safety check: Pass | Apache-2.0 | |
| Nw Query OptimizationnWave-ai/nWave | 617 | — | ~1.3k | Automated safety check: Pass | MIT | |
| DB SculptorEliasOulkadi/shokunin | 114 | — | ~3.1k | Automated safety check: Notes | MIT | |
| Postgresql Best Practices CloudbaseTencentCloudBase/CloudBase-AI-Toolkit | 1.1k | 1 repos | ~1.3k | Automated safety check: Pass | MIT | |
| Discover Databaserand/cc-polymath | 181 | — | ~2k | Automated safety check: Pass | MIT | |
| Query Expertjamesrochabrun/skills | 215 | — | ~4.3k | Automated safety check: Pass | MIT |
nWave-ai/nWave
SQL and NoSQL query optimization techniques, indexing strategies, execution plan analysis, JOIN algorithms, cardinality estimation, and database-specific query patterns
EliasOulkadi/shokunin
Design database schemas with Prisma/Drizzle, PostgreSQL index strategy (B-tree, GIN, GiST, BRIN, Hash), query optimization (EXPLAIN ANALYZE), migration safety (expand/contract, zero-downtime), and…
TencentCloudBase/CloudBase-AI-Toolkit
CloudBase PostgreSQL access-pattern and slow-query quality guidance.
rand/cc-polymath
Automatically discover database skills when working with SQL, PostgreSQL, MongoDB, Redis, database schema design, query optimization, migrations, connection pooling, ORMs, or database selection.
jamesrochabrun/skills
Master SQL and database queries across multiple systems. An agent skill from jamesrochabrun/skills.
ericrisco/rsc-harness
A skill your agent uses when modeling MongoDB documents (embed versus reference, the 16MB cap, bucket and subset patterns), choosing or fixing indexes (compound order by the ESR rule, partial, TTL…
revfactory/harness-100
A skill for analyzing website anti-bot defense mechanisms and developing legitimate evasion strategies.
revfactory/harness-100
Reference for designing how an API reports failures: structured error codes, response shapes, client-friendly messages, an error catalog and retry or fallback advice.
revfactory/harness-100
Walks a backend-dev agent through OWASP API Top 10 checks, authentication and authorization patterns, and defense code during API design.
revfactory/harness-100
Methodology for systematically designing and generating CLI tool argument parser structures.
revfactory/harness-100
Audience segmentation skill used by the analyst and curator agents.
revfactory/harness-100
Audio storytelling skill used by the podcast scriptwriter and show note editor.
Works with
Categories
SQL/NoSQL 쿼리 최적화 패턴, 실행 계획 분석, 인덱스 전략, N+1 문제 해결 등 데이터베이스 성능 최적화 가이드. Query Optimization Patterns is an agent skill from revfactory/harness-100. SQL/NoSQL 쿼리 최적화 패턴, 실행 계획 분석, 인덱스 전략, N+1 문제 해결 등 데이터베이스 성능 최적화 가이드.
Query Optimization Patterns fits situations like: tasks that involve Query optimization; tasks that involve NoSQL databases.
Run `npx skills add revfactory/harness-100 --skill query-optimization-patterns -a claude-code`. Or copy the skill folder (ko/29-performance-optimizer/.claude/skills/query-optimization-patterns in revfactory/harness-100) into .claude/skills/query-optimization-patterns in your project. Claude Code loads it when a task matches its description.
Run `npx skills add revfactory/harness-100 --skill query-optimization-patterns -a codex`. Or copy the skill folder (ko/29-performance-optimizer/.claude/skills/query-optimization-patterns in revfactory/harness-100) into .agents/skills/query-optimization-patterns in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add revfactory/harness-100 --skill query-optimization-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/query-optimization-patterns, .gemini/skills/query-optimization-patterns, .github/skills/query-optimization-patterns and .opencode/skills/query-optimization-patterns in your project.
SKILL.md names no scripts, command-line tools or credentials: Query Optimization Patterns is instructions for the agent only. Our summary lists: Python 3.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Query Optimization Patterns is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1k tokens (SKILL.md is roughly 4.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Query Optimization Patterns: Nw Query Optimization (nWave-ai/nWave, 617 stars), DB Sculptor (EliasOulkadi/shokunin, 114 stars), Postgresql Best Practices Cloudbase (TencentCloudBase/CloudBase-AI-Toolkit, 1.1k stars) and Discover Database (rand/cc-polymath, 181 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
revfactory (a GitHub user) maintains it in revfactory/harness-100, which has 1,290 GitHub stars. The repository holds 464 skills in this directory. The repository was last updated on March 22, 2026.
Source: revfactory/harness-100 on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.