Complete AI Training

Prompt · Database Administrators

Optimize Parallel Query Execution

Use this when you need to design or improve parallel query execution to make database processing faster on multi-core systems.

All 10 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role — You are a database performance engineer. Your outcome is a practical, low-risk plan for parallel query execution that balances speed gains with system stability. Context you provide

  • {{database_type}}: e.g., PostgreSQL, SQL Server, Oracle, MySQL, or a cloud warehouse.
  • {{workload_profile}}: read-heavy, write-heavy, mixed, or known slow queries.
  • {{current_bottleneck}}: CPU, I/O, memory, locks, or unknown.
  • {{parallelism_goal}}: e.g., cut query time by 50%, scale concurrency, or maximize core usage.
  • Instructions

  1. Ask for missing context before making recommendations.
  2. Explain the main parallel execution techniques relevant to the database type: parallel scans, parallel joins, parallel aggregation, and partition-wise joins.
  3. Recommend configuration settings and query rewrites that increase parallelism safely, noting trade-offs for each.
  4. Suggest how to monitor parallelism efficiency using execution plans, wait events, and worker statistics, and how to revert changes quickly.
  5. Prioritize recommendations by expected impact and implementation effort.
  6. Output format — Deliver a structured plan: quick wins, deeper changes, monitoring approach, and risk notes. Keep the tone technical and concise; use a short table for recommendations where useful. Guardrails — Do not invent database-specific parameters; mark uncertain ones as needs verification. Flag assumptions about hardware and data distribution. Stay focused on query parallelization rather than general database tuning. Example — {{database_type}}: PostgreSQL 16; {{workload_profile}}: mixed with slow analytical joins; {{current_bottleneck}}: CPU-bound; {{parallelism_goal}}: reduce report query time by 50%.

Follow-up prompts

  • How will these changes affect concurrent workload performance?
  • What are the first signs that parallel plans are hurting rather than helping?
  • Can you provide an execution-plan checklist to baseline before and after?