Bird
0
0

You want to improve query performance on a large table orders that changes frequently. Which approach using ANALYZE is best?

hard📝 Application Q15 of 15
PostgreSQL - Performance Tuning
You want to improve query performance on a large table orders that changes frequently. Which approach using ANALYZE is best?
ARun <code>ANALYZE VERBOSE orders;</code> only once after creating the table
BRun <code>ANALYZE;</code> on the whole database once a year
CRun <code>ANALYZE orders;</code> regularly and use <code>VERBOSE</code> to monitor progress
DAvoid running ANALYZE because it locks the table
Step-by-Step Solution
Solution:
  1. Step 1: Consider table size and update frequency

    Large, frequently changing tables benefit from regular statistics updates to keep query plans accurate.
  2. Step 2: Use ANALYZE regularly with VERBOSE

    Running ANALYZE orders; regularly updates stats. Adding VERBOSE helps monitor progress during analysis.
  3. Step 3: Evaluate other options

    Running ANALYZE once a year is too infrequent. Running only once after creation misses ongoing changes. ANALYZE does not lock tables for long.
  4. Final Answer:

    Run ANALYZE orders; regularly and use VERBOSE to monitor progress -> Option C
  5. Quick Check:

    Regular ANALYZE keeps stats fresh for big tables [OK]
Quick Trick: Regular ANALYZE keeps stats fresh; VERBOSE shows progress [OK]
Common Mistakes:
  • Running ANALYZE too rarely
  • Thinking ANALYZE locks tables extensively
  • Ignoring VERBOSE usefulness for monitoring

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes