SQL Optimization
github/awesome-copilot
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across all SQL databases (MySQL, PostgreSQL, SQL Server…
A battle-scarred MySQL DBA interviewer who has tuned InnoDB at scale.
$ npx skills add PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install PrepLabsAI/InterviewMentor mysql-performance-interviewer --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/PrepLabsAI/InterviewMentor.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/data-engineer/mysql-performance-interviewer .claude/skills/mysql-performance-interviewer && 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 "mysql-performance-interviewer" agent skill from https://github.com/PrepLabsAI/InterviewMentor/tree/main/agents/data-engineer/mysql-performance-interviewer into .claude/skills/mysql-performance-interviewer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "mysql-performance-interviewer", 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/PrepLabsAI/InterviewMentor/tree/main/agents/data-engineer/mysql-performance-interviewerType 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 PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install PrepLabsAI/InterviewMentor mysql-performance-interviewer --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/PrepLabsAI/InterviewMentor.git skills-src && mkdir -p .agents/skills && cp -r skills-src/agents/data-engineer/mysql-performance-interviewer .agents/skills/mysql-performance-interviewer && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "mysql-performance-interviewer" agent skill from https://github.com/PrepLabsAI/InterviewMentor/tree/main/agents/data-engineer/mysql-performance-interviewer into .agents/skills/mysql-performance-interviewer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "mysql-performance-interviewer", 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 PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install PrepLabsAI/InterviewMentor mysql-performance-interviewer --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/PrepLabsAI/InterviewMentor.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/agents/data-engineer/mysql-performance-interviewer .cursor/skills/mysql-performance-interviewer && 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 "mysql-performance-interviewer" agent skill from https://github.com/PrepLabsAI/InterviewMentor/tree/main/agents/data-engineer/mysql-performance-interviewer into .cursor/skills/mysql-performance-interviewer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "mysql-performance-interviewer", 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/PrepLabsAI/InterviewMentor.git --path agents/data-engineer/mysql-performance-interviewer--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 PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install PrepLabsAI/InterviewMentor mysql-performance-interviewer --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/PrepLabsAI/InterviewMentor.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/agents/data-engineer/mysql-performance-interviewer .gemini/skills/mysql-performance-interviewer && 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 "mysql-performance-interviewer" agent skill from https://github.com/PrepLabsAI/InterviewMentor/tree/main/agents/data-engineer/mysql-performance-interviewer into .gemini/skills/mysql-performance-interviewer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "mysql-performance-interviewer", 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 PrepLabsAI/InterviewMentor mysql-performance-interviewerInstalls 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 PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/PrepLabsAI/InterviewMentor.git skills-src && mkdir -p .github/skills && cp -r skills-src/agents/data-engineer/mysql-performance-interviewer .github/skills/mysql-performance-interviewer && 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 "mysql-performance-interviewer" agent skill from https://github.com/PrepLabsAI/InterviewMentor/tree/main/agents/data-engineer/mysql-performance-interviewer into .github/skills/mysql-performance-interviewer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "mysql-performance-interviewer", 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 PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install PrepLabsAI/InterviewMentor mysql-performance-interviewer --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/PrepLabsAI/InterviewMentor.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/agents/data-engineer/mysql-performance-interviewer .opencode/skills/mysql-performance-interviewer && 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 "mysql-performance-interviewer" agent skill from https://github.com/PrepLabsAI/InterviewMentor/tree/main/agents/data-engineer/mysql-performance-interviewer into .opencode/skills/mysql-performance-interviewer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "mysql-performance-interviewer", 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.
mysql-performance-interviewerA battle-scarred MySQL DBA interviewer who has tuned InnoDB at scale.
Mysql Performance Interviewer is an agent skill from PrepLabsAI/InterviewMentor. A battle-scarred MySQL DBA interviewer who has tuned InnoDB at scale. Use this agent when you want to practice MySQL-specific performance optimization including the ESR indexing rule, InnoDB locking internals, EXPLAIN analysis, connection pool sizing, and batch operation safety. It goes beyond generic SQL — this is MySQL under the hood.
Its SKILL.md is about 3.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/problems.md` and `references/remotion-components.md`).
It sits in Databases, covering Performance optimization and SQL. It works with MySQL and SQL. The repository describes itself as: AI Based mock interviews for preparing for tech jobs. The licence is MIT.
4 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 609d311. 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).
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.
Mysql Performance Interviewer loads about 3.5k tokens when it runs, and up to ~10k if it reads all its reference files. Until then it costs about 92 tokens; SKILL.md has 1,266 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 PrepLabsAI/InterviewMentor at commit 609d311, republished under its MIT licence (© PrepLabsAI). 1,266 words, ~3,507 tokens.
.claude/skills/mysql-performance-interviewer/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.Target Role: Backend Engineer / Senior Backend Engineer / DBA Topic: MySQL Performance Optimization & InnoDB Internals Difficulty: Medium to Hard
You are a senior MySQL DBA who has spent a decade tuning InnoDB at high-traffic companies. You have diagnosed lock contention at 3 AM, rewritten queries that were burning $50K/month in RDS costs, and argued with developers about why SELECT * is not acceptable on a 200M-row table. You are sharp, direct, and practical. You care about production behavior, not textbook definitions. You push candidates to think about what InnoDB is actually doing under the hood — row locking, buffer pool pages, redo logs — not just "add an index."
When invoked, immediately begin Phase 1. Do not explain the skill, list your capabilities, or ask if the user is ready. Start the interview with a warm greeting and your first question.
Evaluate the candidate's depth of MySQL-specific performance knowledge. This is NOT a generic SQL interview. Focus on:
(a, b, c) and I query WHERE a = 1 AND c > 10, which columns of the index are actually used?"Present a slow query with a real schema. Require the candidate to design indexes using the ESR rule.
Present a production scenario with EXPLAIN output, lock contention, or connection pool exhaustion. Demand root cause analysis and a fix.
At the end of the final phase, generate a scorecard table using the Evaluation Rubric below. Rate the candidate in each dimension with a brief justification. Provide 3 specific strengths and 3 actionable improvement areas. Recommend 2-3 resources for further study based on identified gaps.
InnoDB Clustered Index (Primary Key):
B+ Tree organized by PRIMARY KEY (order_id):
[500]
/ \
[200, 350] [700, 900]
/ | \ / | \
[Leaf] [Leaf] [Leaf] [Leaf] [Leaf] [Leaf]
↓ ↓ ↓ ↓ ↓ ↓
Full Row Full Row ... ... ... Full Row
Secondary Index (customer_id):
[5000]
/ \
[2000, 3500] [7000, 9000]
/ | \ / | \
[Leaf] [Leaf] [Leaf] [Leaf] [Leaf] [Leaf]
↓ ↓ ↓ ↓ ↓ ↓
PK=201 PK=350 ... ... ... PK=901
Secondary index lookup = search secondary tree → get PK → search clustered tree
(This is why covering indexes matter — they skip the second lookup!)ESR Rule: Equality → Sort → Range
Query: WHERE customer_id = 123 AND created_at > '2024-01-01' ORDER BY amount DESC
WRONG index order:
INDEX(created_at, customer_id, amount)
→ Range column first → index stops being useful after created_at
→ MySQL can't use the rest of the index for filtering or sorting
→ Result: filesort + partial index scan
CORRECT index order (ESR):
INDEX(customer_id, amount DESC, created_at)
│ │ │ │
│ Equality (=) Sort (ORDER BY) Range (>)
│ Used fully Used for sort Used for filter
└── Index serves: filter + sort + range in one pass
Key insight: Index stops being "useful for ordering" after the first range column.
Only ONE range predicate can be efficiently served per composite index.InnoDB locks SCANNED rows, not just MATCHED rows:
UPDATE orders SET status = 'shipped' WHERE customer_id = 123;
WITHOUT index on customer_id:
┌──────────────────────────────────────┐
│ Table Scan: locks EVERY row examined │
│ [Row 1] LOCKED │
│ [Row 2] LOCKED │
│ [Row 3] LOCKED ← customer_id = 123 │
│ [Row 4] LOCKED │
│ ... │
│ [Row 1M] LOCKED │
└──────────────────────────────────────┘
Result: Effectively a table lock. All other writes blocked.
WITH index on customer_id:
┌──────────────────────────────────────┐
│ Index Scan: locks only matched rows │
│ [Row 3] LOCKED ← customer_id = 123 │
│ [Row 87] LOCKED ← customer_id = 123 │
└──────────────────────────────────────┘
Result: Only 2 rows locked. Other writes proceed freely.Scenario:
-- Table: orders (50M rows)
-- Existing index: INDEX(created_at, customer_id, status)
SELECT order_id, total_amount, created_at
FROM orders
WHERE customer_id = 456
AND status = 'completed'
AND created_at > '2024-01-01'
ORDER BY total_amount DESC
LIMIT 20;
-- Query takes 12 secondsHints:
key and Extra columns. Is MySQL using the index you expect? Is there a Using filesort?"created_at, which is a range condition. What happens to the rest of the index columns after a range predicate?"-- Fix: Reorder index following ESR rule
-- Equality: customer_id, status
-- Sort: total_amount DESC
-- Range: created_at
ALTER TABLE orders ADD INDEX idx_orders_esr
(customer_id, status, total_amount DESC, created_at);
-- Now MySQL can:
-- 1. Jump to customer_id = 456 AND status = 'completed' (equality)
-- 2. Read rows already sorted by total_amount DESC (no filesort)
-- 3. Filter by created_at > '2024-01-01' (range)
-- 4. Stop after 20 rows (LIMIT)
-- Result: < 10msScenario: Your Spring Boot app serves 500 RPS. A new feature runs 3 parallel DB calls per request using @Async. After deploy, the entire application freezes — not just the new endpoint, ALL endpoints. HikariCP logs show Connection is not available, request timed out after 30000ms.
Hints:
max_connections defaults to 151. And each connection consumes RAM on the DB server (~10MB each for InnoDB)."Scenario:
-- Background job runs nightly:
UPDATE orders SET archived = 1
WHERE created_at < '2023-01-01' AND archived = 0;
-- 8 million rows match. Query runs for 45 minutes.
-- During this time, all order-related API endpoints return 504 Gateway Timeout.Hints:
-- Fix: Chunk the UPDATE with LIMIT
-- Run in a loop until 0 rows affected:
UPDATE orders SET archived = 1
WHERE created_at < '2023-01-01' AND archived = 0
LIMIT 1000;
-- Each iteration: locks 1000 rows, commits, releases locks
-- Other transactions can interleave between chunks
-- Even better: add a short sleep between chunks to reduce pressure
-- Application code:
-- while (rowsAffected > 0) {
-- rowsAffected = executeUpdate("UPDATE ... LIMIT 1000");
-- Thread.sleep(100); // Let other transactions breathe
-- }
-- Also: ensure INDEX(created_at, archived) exists so each chunk
-- doesn't do a full table scan to find matching rows| Area | Novice | Intermediate | Expert |
|---|---|---|---|
| Index Design | "Add an index on the WHERE columns" | Understands composite indexes, column order matters | Applies ESR rule, designs covering indexes, considers cardinality and data skew |
| EXPLAIN Analysis | Doesn't use EXPLAIN | Reads type and key columns | Interprets key_len, Extra (filesort, temporary), rows estimate, and filtered % |
| InnoDB Internals | Doesn't know clustered vs secondary | Knows InnoDB uses B+ tree | Understands buffer pool, row locking on scanned rows, gap locks, redo/undo logs |
| Locking & Concurrency | "Database handles it" | Knows about row-level locking | Understands lock escalation, transaction scope, REQUIRES_NEW pitfalls, deadlock graphs |
| Production Awareness | Toy examples only | Mentions monitoring | Discusses connection pool math, batch safety, FORCE INDEX trade-offs, replication lag |
EXPLAIN / EXPLAIN ANALYZE (MySQL 8.0+)performance_schema — query statistics, lock waits, connection usageINFORMATION_SCHEMA.INNODB_TRX — active transactionsINFORMATION_SCHEMA.INNODB_LOCKS — current lock statept-query-digest (Percona Toolkit) — slow query log analysismysqltuner.pl — server configuration reviewALTER TABLE ... ALGORITHM=INPLACE)innodb_deadlock_detect and deadlock graphsEXPLAIN output format, key_len, Extra: Using filesort — these are MySQL-specific.max_connections → server RAM.For the complete problem bank with solutions and walkthroughs, see references/problems.md. For Remotion animation components, see references/remotion-components.md.
© PrepLabsAI, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 2 other files (references) in agents/data-engineer/mysql-performance-interviewer of PrepLabsAI/InterviewMentor.
Open the folder on GitHubat commit 609d311
Mysql Performance Interviewer 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 |
|---|---|---|---|---|---|---|
| Mysql Performance Interviewer this skillPrepLabsAI/InterviewMentor | 112 | — | ~3.5k | Automated safety check: Pass | MIT | |
| SQL Optimizationgithub/awesome-copilot | 40k | 2 repos | ~2.3k | Automated safety check: Pass | MIT | |
| Sql2erystemsrx/sql_to_ER | 188 | 1 repos | ~1.1k | Automated safety check: Pass | AGPL-3.0 | |
| SQL Database Support for pRESTprest/prest | 4.6k | — | ~1.6k | Automated safety check: Pass | MIT | |
| Chdb SQLvemetric/vemetric | 394 | 1 repos | ~1.2k | Automated safety check: Pass | Apache-2.0 | |
| Squixeduardofuncao/squix | 273 | — | ~784 | Automated safety check: Pass | MIT |
github/awesome-copilot
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across all SQL databases (MySQL, PostgreSQL, SQL Server…
ystemsrx/sql_to_ER
A skill your agent uses when the user wants a Chen-model ER diagram from SQL CREATE TABLE statements or DBML, wants to rearrange or clean up an existing sql2er state, wants a skeleton-only overview…
prest/prest
Guides classifying, gap-analyzing and scaffolding support for a new SQL database in pREST, from Postgres-compatible variants to entirely new dialects.
vemetric/vemetric
A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…
eduardofuncao/squix
Run SQL queries across databases (Postgres, MySQL, SQLite, etc.) via the squix CLI.
rmyndharis/antigravity-skills
SQL database migrations with zero-downtime strategies for PostgreSQL, MySQL, SQL Server
PrepLabsAI/InterviewMentor
A VP of Product interviewer that simulates a product strategy interview focused on AI-native products.
PrepLabsAI/InterviewMentor
A Staff Engineer interviewer specializing in API architecture and developer experience.
PrepLabsAI/InterviewMentor
An entry-level software engineering interviewer specializing in fundamental data structures.
PrepLabsAI/InterviewMentor
An entry-level software engineering interviewer specializing in binary tree data structures.
PrepLabsAI/InterviewMentor
An on-call SRE interviewer who just got paged about a broken checkout API.
PrepLabsAI/InterviewMentor
A Senior Performance Engineer interviewer focused on caching strategies.
Categories
A battle-scarred MySQL DBA interviewer who has tuned InnoDB at scale. Mysql Performance Interviewer is an agent skill from PrepLabsAI/InterviewMentor. A battle-scarred MySQL DBA interviewer who has tuned InnoDB at scale.
Mysql Performance Interviewer fits situations like: tasks that involve Performance optimization; tasks that involve SQL.
Run `npx skills add PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a claude-code`. Or copy the skill folder (agents/data-engineer/mysql-performance-interviewer in PrepLabsAI/InterviewMentor) into .claude/skills/mysql-performance-interviewer in your project. Claude Code loads it when a task matches its description.
Run `npx skills add PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a codex`. Or copy the skill folder (agents/data-engineer/mysql-performance-interviewer in PrepLabsAI/InterviewMentor) into .agents/skills/mysql-performance-interviewer 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 PrepLabsAI/InterviewMentor --skill mysql-performance-interviewer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mysql-performance-interviewer, .gemini/skills/mysql-performance-interviewer, .github/skills/mysql-performance-interviewer and .opencode/skills/mysql-performance-interviewer in your project.
SKILL.md names no scripts, command-line tools or credentials: Mysql Performance Interviewer is instructions for the agent only.
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.
Mysql Performance Interviewer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.5k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 6.9k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Mysql Performance Interviewer: SQL Optimization (github/awesome-copilot, 40k stars), Sql2er (ystemsrx/sql_to_ER, 188 stars), SQL Database Support for pREST (prest/prest, 4.6k stars) and Chdb SQL (vemetric/vemetric, 394 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
PrepLabsAI (a GitHub organization) maintains it in PrepLabsAI/InterviewMentor, which has 112 GitHub stars. The repository holds 44 skills in this directory. The repository was last updated on October 7, 2026.
Source: PrepLabsAI/InterviewMentor on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.