sql-expert

Analyze and optimize SQL queries across PostgreSQL, MySQL, and H2.

39|Updated Apr 21, 2025
One-click install
npx skills add https://github.com/lemline/lemline --skill sql-expert-lemline
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-expert
Source: https://github.com/lemline/lemline/tree/main/.claude/skills/sql-expert
Command: npx skills add https://github.com/lemline/lemline --skill sql-expert-lemline

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers optimize SQL queries across PostgreSQL, MySQL, and H2, improving performance and ensuring cross-database compatibility for Lemline's multi-database architecture.

Core Features & Use Cases

  • Cross-database query review and compatibility checks against PostgreSQL, MySQL, and H2.
  • Index design guidance and automated recommendations for WHERE, ORDER BY, and join patterns.
  • Execution plan analysis using EXPLAIN/EXPLAIN ANALYZE across all three databases, with actionable optimizations.
  • Identification of common anti-patterns (N+1, function on indexed columns, missing limits) and practical fixes.
  • Real-world scenarios: debugging slow queries, tuning complex analytics, and portable SQL design.

Quick Start

Provide a slow or complex query to the skill and receive an optimized version, index recommendations, and cross-database notes.

Frequently Asked Questions about sql-expert

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

FAQPage Schema
How do I optimize slow SQL queries across PostgreSQL, MySQL, and H2?

Optimize slow SQL queries by analyzing execution plans and applying index recommendations for PostgreSQL, MySQL, and H2. The skill reviews cross-database compatibility, identifies anti-patterns, and provides an optimized query version with indexing guidance.

How do I analyze an EXPLAIN plan to fix complex joins?

Analyze EXPLAIN and EXPLAIN ANALYZE outputs to identify execution bottlenecks in complex joins. The skill translates execution plans into actionable optimizations, suggesting index designs and query rewrites for join patterns across PostgreSQL, MySQL, and H2.

What are the best index recommendations for WHERE and ORDER BY clauses?

Index recommendations for WHERE and ORDER BY clauses target columns used in filtering and sorting to reduce scan overhead. The skill provides automated index design guidance based on your specific query patterns and cross-database compatibility requirements.

Why does my SQL query perform poorly due to N+1 issues or functions on indexed columns?

Poor SQL query performance from N+1 issues or functions on indexed columns stems from common anti-patterns that bypass indexes. The skill identifies these anti-patterns, including missing limits, and applies practical fixes to restore execution speed.

Does this tool check cross-database compatibility for portable SQL design?

Yes, cross-database compatibility checks validate your SQL syntax and logic against PostgreSQL, MySQL, and H2. This ensures portable SQL design within Lemline's multi-database architecture, preventing dialect-specific errors during deployment.

What should I provide to start debugging a slow running query?

Provide your slow or complex query to receive an optimized version, index recommendations, and cross-database notes. The skill processes the input query to deliver actionable execution plan analysis and anti-pattern fixes.