database-pro

Optimizes SQL queries, designs schemas, and administers PostgreSQL and MySQL databases.

9|Updated Jul 17, 2026
One-click install
npx skills add https://github.com/Yassimba/loom --skill database-pro-yassimba
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-pro
Source: https://github.com/Yassimba/loom/tree/main/skills/database-pro
Command: npx skills add https://github.com/Yassimba/loom --skill database-pro-yassimba

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Slow queries, risky schema migrations, and misconfigured database servers are hard to diagnose without deep PostgreSQL and MySQL expertise. This Skill provides senior-level database engineering guidance grounded in measured evidence rather than guesswork. ## Core Features & Use Cases - Query Optimization: Analyzes EXPLAIN (ANALYZE, BUFFERS) plans before and after changes, rewrites row-by-row logic into set-based SQL, and designs B-tree, GIN, GiST, BRIN, covering, and partial indexes. - Schema Design & Migrations: Covers normalization, constraints, temporal data, audit trails, and zero-downtime expand-migrate-contract deployment patterns with batched backfills. - Administration & Monitoring: Tunes PostgreSQL memory, VACUUM, autovacuum, replication, and partitioning, plus MySQL InnoDB buffer pool, slow query log, and performance_schema alerting. - Use Case: A production orders table scans sequentially on every lookup. The Skill identifies the missing composite index, builds it concurrently, and reports before/after EXPLAIN timings with a monitoring query to confirm the fix holds. ## Quick Start Use the database-pro skill to analyze this slow PostgreSQL query and recommend indexes with before and after EXPLAIN ANALYZE results.

Frequently Asked Questions about database-pro

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize a slow SQL query in PostgreSQL?

Run EXPLAIN (ANALYZE, BUFFERS) before and after each change, modifying one variable at a time. Look for sequential scans on large tables, then add indexes matched to the query pattern and rewrite row-by-row logic as joins, window functions, or CTEs.

How do I add an index to a large table without downtime?

Use CREATE INDEX CONCURRENTLY in PostgreSQL, which cannot run inside a transaction block. In MySQL, verify the online DDL ALGORITHM and LOCK behavior for your version. A failed concurrent build can leave an invalid index that must be removed before retrying.

What is the difference between PostgreSQL and MySQL SQL syntax?

Key differences include auto-increment (SERIAL vs AUTO_INCREMENT), string concatenation (|| vs CONCAT), upserts (ON CONFLICT vs ON DUPLICATE KEY), boolean handling, and JSONB versus JSON operators. Window function frame specifications with intervals work only in PostgreSQL.

How do I run a zero-downtime database migration?

Use the expand-migrate-contract pattern: add the new nullable structure, deploy code compatible with both versions, backfill in bounded idempotent batches, verify consistency, then remove old structures only after no supported application version uses them.

Why is my PostgreSQL table bloated and how do I fix it?

Bloat comes from dead tuples that VACUUM has not reclaimed. Check n_dead_tup in pg_stat_user_tables, tune autovacuum scale factors per table for high-churn data, and remove existing bloat with pg_repack or REINDEX CONCURRENTLY instead of locking VACUUM FULL.

When should I use JSONB versus regular columns in PostgreSQL?

Use JSONB for variable or sparse attributes, indexed with GIN or expression indexes on hot paths. Extract frequently updated or heavily filtered values into regular typed columns, since JSONB suits containment queries but not high-update workloads.