database-query-optimization

Analyze EXPLAIN ANALYZE diagnostics and apply indexing to optimize database queries.

Updated May 17, 2026
One-click install
npx skills add https://github.com/cenjie/skills --skill database-query-optimization-cenjie
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-query-optimization
Source: https://github.com/cenjie/skills/tree/main/skills/database-query-optimization
Command: npx skills add https://github.com/cenjie/skills --skill database-query-optimization-cenjie

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Slow database queries hinder application performance; this skill helps reduce latency by optimizing indexing, query structure, and execution plans.

Core Features & Use Cases

  • Indexing strategies to speed up WHERE, JOIN, and ORDER BY operations.
  • Query optimization techniques including rewriting, avoiding functions on predicates, and using pre-aggregations.
  • Use Case: When facing slow response times on large datasets, analyze plans, apply indexing changes, and validate improvements with EXPLAIN ANALYZE.

Quick Start

Analyze a representative query with EXPLAIN ANALYZE and apply indexing and query-tuning steps to verify improvements.

Frequently Asked Questions about database-query-optimization

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

FAQPage Schema
How do I optimize slow database queries and reduce latency?

To optimize slow database queries, you apply profiling, indexing strategies, and execution plan analysis to identify bottlenecks and validate improvements using EXPLAIN ANALYZE diagnostics across your workloads.

What is the best way to use indexing strategies for WHERE, JOIN, and ORDER BY operations?

The best way to apply indexing strategies is to analyze your query execution plans and implement targeted indexes that directly speed up WHERE, JOIN, and ORDER BY operations to reduce latency on large datasets.

How does EXPLAIN ANALYZE help with query optimization?

EXPLAIN ANALYZE helps with query optimization by providing diagnostic execution plans that reveal performance bottlenecks, allowing you to validate improvements after applying indexing and query rewriting techniques.

Can I use these query optimization techniques for both OLTP and OLAP workloads?

Yes, you can use these query optimization techniques for both OLTP and OLAP workloads to profile performance, apply indexing, and analyze execution plans to reduce latency across different database workload patterns.

Why does avoiding functions on predicates improve database performance?

Avoiding functions on predicates improves database performance by allowing the query engine to utilize indexing strategies effectively, preventing full table scans and reducing execution plan latency.

What query rewriting techniques help speed up slow queries on large datasets?

Query rewriting techniques to speed up slow queries include avoiding functions on predicates, using pre-aggregations, and optimizing query structure to reduce latency and improve execution plan efficiency on large datasets.