sql-and-query-optimization

Optimize SQL and ORM-generated queries by analyzing execution plans and indexes.

Updated Apr 25, 2026
One-click install
npx skills add https://github.com/Tiepbm/software-engineering-agent --skill sql-and-query-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-and-query-optimization
Source: https://github.com/Tiepbm/software-engineering-agent/tree/main/skills/sql-and-query-optimization
Command: npx skills add https://github.com/Tiepbm/software-engineering-agent --skill sql-and-query-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Optimizes SQL and ORM-generated queries to reduce latency, resource usage, and lock contention, without altering business results.

Core Features & Use Cases

  • Analyze execution plans, row estimates, and bottlenecks to identify inefficient predicates, scans, and join orders.
  • Align indexes with common predicates, joins, and sorting to improve coverage and minimize write costs.
  • Validate changes with before/after measurements, and ensure safe rollout with rollback plans and monitoring.

Quick Start

Run an actual execution plan analysis on a representative query and implement the recommended index or rewrite changes to validate performance gains.

Frequently Asked Questions about sql-and-query-optimization

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

FAQPage Schema
How do I optimize slow ORM-generated queries in Django or EF Core?

To optimize ORM-generated queries, you must analyze execution plans and row estimates to identify inefficient predicates and scans. This process aligns indexes with common predicates and joins to improve coverage and minimize write costs across ORM frameworks like Django and EF Core.

What is the best way to analyze an SQL execution plan for bottlenecks?

Analyzing an SQL execution plan involves examining row estimates and identifying bottlenecks like inefficient predicates, table scans, and poor join orders. This approach pinpoints exact latency sources and resource usage issues without altering your business logic.

Can I use query tuning to reduce lock contention in OLTP workloads?

Yes, query tuning reduces lock contention in OLTP workloads by optimizing SQL and ORM-generated queries. Aligning indexes with common predicates and optimizing join orders lowers resource usage and minimizes the time locks are held.

How do I validate performance gains after applying index recommendations?

You validate performance gains by taking before and after measurements of query latency and resource usage. This ensures the indexing and join strategy changes deliver measurable improvements while maintaining safe deployment.

Does query optimization work for both OLTP and OLAP workloads?

Yes, query optimization works for both OLTP and OLAP workloads by applying execution plan analysis, index alignment, and join strategy adjustments. This reduces latency and resource usage across different database workload patterns.