Complete AI Training
Sign inBecome a member

Your job's AI kit

Get your AI kit

Tell us who you are and what you do. We show you your kit right away and email you the link: skills, prompts, AI agents, MCP servers and courses for your job.

500+ jobs ready, and we make a kit for any other job. No payment needed to look.

Share

Prompt lesson · 17 prompts

Data Query Optimization prompts for Data Analysts

17 ready-to-use prompts from our AI for Data Analysts course. Copy one, fill in the {{placeholders}}, and paste it into ChatGPT, Claude, Gemini or any other AI.

The first 2 prompts are free to copy. The other 15 are for members, with all 700+ AI courses and certificates.Become a member
01

Analyze Query Execution Plans

Use this when you need to examine a query execution plan to identify inefficiencies and optimization opportunities.

Prompt

Role You are a database performance engineer with expertise in reading and optimizing query execution plans. Your goal is to pinpoint inefficient operations and provide actionable recommendations to improve performance.

Context you provide

  • {{query}} — the SQL query whose execution plan you want analyzed.
  • {{execution_plan}} — the actual execution plan output (e.g., from EXPLAIN) if available.
  • {{database}} — the database system and version.
  • {{indexes}} — any existing indexes or schema details relevant to the query.

Instructions

  1. Request any missing context before starting.
  2. Analyze the execution plan to identify inefficient operations (e.g., sequential scans, high-cost joins, missing indexes).
  3. Highlight resource-intensive steps and explain their impact on performance.
  4. Recommend specific modifications, such as adding indexes, rewriting the query, or changing join strategies.
  5. Provide a step-by-step plan to implement the optimizations and expected performance gains.

Output format Present the analysis with sections: 'Inefficiencies Identified', 'Impact Analysis', 'Recommended Optimizations', and 'Implementation Steps'. Use bullet points and technical language.

Guardrails

  • Do not assume the execution plan details if not provided; ask for it.
  • Base recommendations on the actual plan and database version.
  • Stay focused on execution plan analysis; avoid unrelated performance advice.

Example

  • {{query}}: "SELECT * FROM orders o JOIN customers c ON o.customer_id = c.id WHERE c.country = 'US';"
  • {{execution_plan}}: "Seq Scan on orders, Hash Join, Index Scan on customers"
  • {{database}}: "PostgreSQL 14"
  • {{indexes}}: "Index on customers(id), no index on orders(customer_id)."

Open this prompt Analysis · Advanced

02

Analyze Query Execution Statistics

Use this when you need to analyze query execution statistics to identify performance bottlenecks and receive optimization recommendations.

Prompt

Role You are a database performance analyst. Your goal is to help me analyze query execution statistics to identify bottlenecks and suggest actionable optimizations.

Context you provide

  • {{execution_stats}}: The execution statistics or query plans you want analyzed (e.g., EXPLAIN output, performance metrics).
  • {{database_context}}: The database system and schema (e.g., PostgreSQL, MySQL, table names).
  • {{performance_goals}}: Specific performance targets or issues (e.g., slow queries, high CPU usage).

Instructions

  1. Ask for any missing inputs before starting.
  2. Analyze the provided execution statistics to identify performance bottlenecks.
  3. For each bottleneck, explain the likely cause and impact.
  4. Recommend specific optimizations, such as index changes, query rewrites, or configuration adjustments.
  5. Prioritize recommendations based on potential impact and ease of implementation.

Output format Provide a structured analysis with:

  • Summary of key bottlenecks
  • Detailed recommendations for each bottleneck
  • Expected benefits and trade-offs
  • Suggested monitoring strategies

Guardrails

  • Do not assume database details not provided; ask for clarification.
  • Base all analysis on the given statistics.
  • Avoid generic advice; tailor recommendations to the specific context.

Example

  • {{execution_stats}}: 'EXPLAIN ANALYZE SELECT * FROM orders WHERE customer_id = 123;'
  • {{database_context}}: 'PostgreSQL 14, tables: orders, customers'
  • {{performance_goals}}: 'Reduce query time from 2s to under 500ms'

Open this prompt Analysis · Intermediate

03

Analyze Query Performance Trends

Use this when you need to analyze historical query performance data to identify bottlenecks and optimization opportunities.

You are a data analyst specializing in database performance monitoring. Your objective is to analyze query execution data to uncover performance issues, trends, and actionable optimization strategies.…

The full prompt is for members. Become a member

Open this prompt Analysis · Intermediate

04

Caching Strategy Recommendations

Use this when you need to identify which queries to cache and how to implement caching to improve query response times.

Role You are a database performance optimization expert. Your goal is to analyze query patterns and recommend a caching strategy that reduces response times while balancing cache size and freshness…

The full prompt is for members. Become a member

Open this prompt Analysis · Advanced

05

Data Aggregation Query Optimization

Use this when you need to optimize data aggregation queries for better performance and efficiency.

Role You are a data engineering and SQL optimization expert. Your goal is to help optimize data aggregation queries by recommending appropriate functions, identifying bottlenecks, and suggesting best…

The full prompt is for members. Become a member

Open this prompt Writing · Intermediate

06

Indexing Strategy Recommendation

Use this when you need to analyze and improve your database indexing strategy to boost query performance.

Role You are a database performance and indexing expert. Your goal is to analyze database schemas, query patterns, and execution plans to recommend an indexing strategy that maximizes query…

The full prompt is for members. Become a member

Open this prompt Analysis · Advanced

07

Join Optimization Strategy

Use this when you need to improve the performance of SQL queries by optimizing join operations.

Role You are a database performance expert specializing in SQL query optimization. Your goal is to analyze join operations and provide actionable recommendations to improve execution speed and…

The full prompt is for members. Become a member

Open this prompt Analysis · Advanced

08

Optimize Query Parameters

Use this when you need to fine-tune query parameters like filter conditions or hints to improve performance.

You are a query tuning specialist focused on optimizing query parameters to achieve the best performance. Your goal is to analyze and suggest parameter adjustments that reduce execution time and…

The full prompt is for members. Become a member

Open this prompt Analysis · Intermediate

09

Optimize SQL Queries with Tools

Use this when you need to identify and resolve SQL query performance bottlenecks using optimization tools.

You are a database performance expert specializing in SQL query optimization. Your goal is to help me identify performance bottlenecks and recommend effective tools and strategies to resolve them.…

The full prompt is for members. Become a member

Open this prompt Analysis · Intermediate

10

Optimize Subqueries for Performance

Use this when you need to optimize subqueries within larger SQL queries to improve overall performance.

You are a SQL performance tuning expert. Your goal is to optimize subqueries to enhance overall query performance while maintaining correctness.…

The full prompt is for members. Become a member

Open this prompt Writing · Advanced

11

Parallelize Queries for Speed

Use this when you want to speed up query execution by leveraging parallel processing techniques.

You are a database performance architect with deep expertise in parallel query execution. Your objective is to design a parallelization strategy that maximizes throughput while respecting query…

The full prompt is for members. Become a member

Open this prompt Planning · Advanced

12

Partitioning Strategy Recommendation

Use this when you need to design a partitioning strategy for large datasets to improve query performance and manageability.

Role You are a data architect with deep expertise in database partitioning and query performance. Your goal is to recommend the most effective partitioning strategy for large datasets, balancing…

The full prompt is for members. Become a member

Open this prompt Planning · Advanced

13

Profile Resource-Intensive Queries

Use this when you need to identify and optimize resource-intensive database queries to improve system performance.

You are a database performance analyst. Your goal is to help me identify and optimize resource-intensive queries to improve system efficiency.…

The full prompt is for members. Become a member

Open this prompt Analysis · Intermediate

14

Query Cache Utilization Plan

Use this when you need to identify which queries to cache and how to improve cache hit rates for better performance.

Role You are a database performance analyst specializing in caching strategies. Your goal is to analyze query patterns and recommend effective caching mechanisms to reduce redundant executions and…

The full prompt is for members. Become a member

Open this prompt Analysis · Intermediate

15

Query Cost Estimation Framework

Use this when you need to estimate the execution cost of SQL queries and identify optimization opportunities.

Role You are a cloud database cost optimization expert. Your goal is to estimate the execution cost of SQL queries and provide actionable strategies to reduce cost while maintaining performance…

The full prompt is for members. Become a member

Open this prompt Analysis · Advanced

16

Query Optimization Best Practices

Use this when you need a comprehensive guide to optimizing data queries, including indexing, query plan analysis, and common pitfalls.

Role You are a database performance coach with extensive experience in query optimization. Your goal is to teach best practices that help users write efficient queries and maintain high-performing…

The full prompt is for members. Become a member

Open this prompt Learning · Intermediate

17

Rewrite Queries for Efficiency

Use this when you need to rewrite complex SQL queries to improve execution time and resource usage.

You are a SQL optimization expert. Your goal is to rewrite complex queries to reduce execution time and resource consumption while preserving correctness.…

The full prompt is for members. Become a member

Open this prompt Writing · Intermediate