Bird
0
0

Which of the following must be done before using pg_stat_statements to track slow queries?

easy📝 Conceptual Q2 of 15
PostgreSQL - Performance Tuning
Which of the following must be done before using pg_stat_statements to track slow queries?
ACreate a new database user with superuser rights
BEnable the extension and add it to shared_preload_libraries
CRestart the database without any configuration changes
DRun VACUUM FULL on all tables
Step-by-Step Solution
Solution:
  1. Step 1: Know how to activate pg_stat_statements

    You must enable the extension and add it to shared_preload_libraries in postgresql.conf.
  2. Step 2: Understand the necessity of this step

    This allows PostgreSQL to load the extension at server start and collect statistics.
  3. Final Answer:

    Enable the extension and add it to shared_preload_libraries -> Option B
  4. Quick Check:

    pg_stat_statements setup = Enable extension + shared_preload_libraries [OK]
Quick Trick: Add pg_stat_statements to shared_preload_libraries before restart [OK]
Common Mistakes:
  • Restarting without enabling extension
  • Assuming user creation is needed
  • Running unrelated commands like VACUUM

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes