• Browse Prompts
  • Trending
  • Saved Prompts
  • Web Dev
  • Marketing
  • Blog
  • Submit Your Prompt
PromptsVault AI LogoPromptsVault AI
  • Browse
  • Trending
  • Blog
  • Saved
  • Submit Your Prompt
PromptsVault AI LogoPromptsVault AI

The world's best AI prompts library. Hand-curated, high-quality prompts for ChatGPT, Claude, and Midjourney. Built for productivity and high-accuracy results.

Categories

  • Web Dev
  • AI/ML
  • Marketing
  • Coding
  • Creative
  • View All →

Popular Topics

  • chatgpt
  • midjourney
  • marketing
  • coding
  • seo
  • writing
  • social media
  • email

Legal

  • About Us
  • AI Blog
  • Privacy
  • Terms
  • Disclaimer

© 2026 PromptsVault AI. All rights reserved.

PromptsVault AI is thinking...

Searching the best prompts from our community

ChatGPTMidjourneyClaude
  1. Home
  2. Library
  3. CODING
  4. PostgreSQL query performance tuning guide
CODING
43 views
AI Prompt for

PostgreSQL query performance tuning guide

💡 USAGE TIPS
Optional - Click to learn how to use this prompt effectively

💡 Pro Developer Tips

Click to view expert tips

Specify framework versions

e.g., 'Next.js 14', 'Python 3.11' for accurate, up-to-date code

Request error handling & types

Ask for TypeScript definitions and try-catch blocks

Get step-by-step breakdowns

Request explanations before code for complex logic

Pro tip: The more context you provide, the better your results!
ACTUAL PROMPT BELOW
PROMPT
Copy & Use FREE

🎭 Role

You are a Senior PostgreSQL Database Reliability Engineer (DBRE) and Performance Tuning Expert with over 15 years of experience in managing high-scale, mission-critical relational database systems. Your expertise lies in deep query optimization, locking analysis, storage engine internals, and high-concurrency architecture.

🌐 Context

We are currently experiencing performance degradation in our [DATABASE_NAME] environment, characterized by increased latency and high CPU utilization. As the lead database engineer, your goal is to provide a comprehensive, actionable audit and optimization strategy to restore system stability and improve query throughput.

🛠️ Task Instruction

Perform a systematic performance analysis and optimization workflow covering the following dimensions:

  1. Identification: Formulate queries for pg_stat_statements to pinpoint the top 5 most expensive queries by total execution time and mean latency.
  2. Execution Plan Analysis: Explain the methodology for interpreting EXPLAIN (ANALYZE, BUFFERS, VERBOSE) output. Identify common anti-patterns such as Sequential Scans, Hash Joins on unindexed columns, and Bookmark lookups.
  3. Indexing Strategy: Outline how to design covering indexes (including INCLUDE clauses) to minimize I/O.
  4. Join Optimization: Provide strategies for rewriting inefficient JOINs, handling cross-joins, and optimizing subqueries.
  5. Maintenance & Vacuuming: Define a robust Autovacuum tuning strategy, specifically addressing bloat management and transaction ID wraparound prevention.
  6. Architectural Scaling: Provide a decision framework for when to implement Declarative Partitioning versus Sharding.
  7. Resource Tuning: Provide specific recommendations for work_mem, shared_buffers, and effective_cache_size based on a system with [TOTAL_RAM] of RAM.
  8. Connection Management: Explain how to determine the optimal pool size for [APPLICATION_NAME] using PgBouncer.
  9. Index Maintenance: Create a long-term strategy for monitoring index bloat and identifying unused indexes.

⚖️ Constraints & Tone

  • Tone: Professional, technical, and highly analytical.
  • Precision: Avoid generic advice; provide specific PostgreSQL configuration patterns and SQL syntax.
  • Prohibitions: Do not suggest proprietary third-party monitoring tools unless they are industry-standard open-source extensions. Do not provide conversational filler.

📝 Output Format

Structure your response as follows:

  • Executive Summary: A brief diagnostic assessment of the identified problem areas.
  • Technical Audit Steps: A step-by-step technical guide for each task listed above.
  • Implementation Checklist: A high-priority list of immediate fixes vs. long-term architectural improvements.
  • Code Snippets: All SQL commands and configuration examples should be formatted in blocks with brief annotations explaining the impact.

Placeholders

  • [DATABASE_NAME]: The specific application or DB cluster being analyzed.
  • [TOTAL_RAM]: Total memory available on the database server.
  • [APPLICATION_NAME]: The application connecting to the DB.
Pro Tip: This prompt is engineered to favor SEO-best practices, helping you generate high-ranking, authoritative content that satisfies user intent.
Disclaimer: AI models can hallucinate. Please verify this prompt's output before use. PromptsVault AI is not responsible for AI-generated content.

About This Prompt

What is a good ChatGPT prompt for PostgreSQL query performance tuning guide?

A proven free prompt for PostgreSQL query performance tuning guide is: "Analyze and optimize PostgreSQL query performance. Steps: 1. Identify slow queries with pg_stat_statements. 2. Analyze Execution plans (EXPLAIN ANALYZE). 3. Create covering indexes for frequent querie..." — You can copy it for free on PromptsVault AI and paste it directly into ChatGPT, Claude, or Gemini.

How do I use this CODING AI prompt for PostgreSQL query performance tuning guide?

Click the 'Copy Prompt' button at the top of the page, then paste the text into ChatGPT, Claude, Gemini, or any AI model. You can customize any variables in [brackets] to fit your specific needs before submitting.

Is the PostgreSQL query performance tuning guide prompt free to use?

Yes — this CODING AI prompt is 100% free on PromptsVault AI. No sign-up or payment required. You can copy and use it for personal or commercial projects with no attribution needed.

Which AI tools work best with this PostgreSQL query performance tuning guide prompt?

This prompt works with all major AI tools — ChatGPT (GPT-4o), Claude 3 (Anthropic), Google Gemini, Grok (xAI), Microsoft Copilot, Perplexity, Mistral, and Llama. The prompt is written in plain language so it's compatible with any large language model.

Related Tags

#database#postgresql#sql#performance

Advertisement

Join the Community

Submit your prompts and join our elite community of creators!

Submit Now

Related Prompts

C

Scalable URL shortener system design

CODING

C

Scalable Cypress E2E testing framework

CODING

C

Security best practices OWASP Top 10

CODING

C

Unity physics optimization for mobile games

CODING