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.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
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
- Ask for missing context before making recommendations.
- Explain the main parallel execution techniques relevant to the database type: parallel scans, parallel joins, parallel aggregation, and partition-wise joins.
- Recommend configuration settings and query rewrites that increase parallelism safely, noting trade-offs for each.
- Suggest how to monitor parallelism efficiency using execution plans, wait events, and worker statistics, and how to revert changes quickly.
- Prioritize recommendations by expected impact and implementation effort.
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?