Bird
0
0

You want to reset all collected statistics in pg_stat_statements to start fresh after fixing slow queries. Which command should you run?

hard📝 Application Q15 of 15
PostgreSQL - Performance Tuning
You want to reset all collected statistics in pg_stat_statements to start fresh after fixing slow queries. Which command should you run?
ATRUNCATE pg_stat_statements;
BSELECT pg_stat_statements_reset();
CDROP EXTENSION pg_stat_statements;
DRESET pg_stat_statements;
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct function to reset stats

    PostgreSQL provides the function pg_stat_statements_reset() to clear collected statistics.
  2. Step 2: Evaluate other options

    RESET is not valid syntax here, DROP EXTENSION removes the extension, and TRUNCATE is not allowed on this view.
  3. Final Answer:

    SELECT pg_stat_statements_reset(); -> Option B
  4. Quick Check:

    Reset stats = pg_stat_statements_reset() function [OK]
Quick Trick: Use SELECT pg_stat_statements_reset() to clear stats [OK]
Common Mistakes:
  • Trying to DROP the extension to reset stats
  • Using RESET command incorrectly
  • Attempting to TRUNCATE the stats view

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes