Bird
0
0

A query to find slow queries is:

medium📝 Debug Q7 of 15
PostgreSQL - Performance Tuning
A query to find slow queries is:
SELECT query, mean_time FROM pg_stat_statements ORDER BY mean_time DESC;

But it returns no rows. What could be wrong?
ANo queries have been executed since pg_stat_statements was enabled
BThe query syntax is incorrect
Cpg_stat_statements is disabled in postgresql.conf
DThe user lacks SELECT permission on pg_stat_statements
Step-by-Step Solution
Solution:
  1. Step 1: Check if queries have run

    If no queries have run since enabling, the stats table will be empty.
  2. Step 2: Confirm query syntax and permissions

    The syntax is correct and permissions usually allow reading this view.
  3. Final Answer:

    No queries have been executed since pg_stat_statements was enabled -> Option A
  4. Quick Check:

    Empty pg_stat_statements = no queries run yet [OK]
Quick Trick: Run some queries first to populate pg_stat_statements [OK]
Common Mistakes:
  • Assuming syntax error
  • Blaming permissions without checking
  • Thinking extension is disabled

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes