Bird
0
0

Which of the following SQL commands correctly shows the query plan including whether a sequential or index scan is used?

easy📝 Syntax Q3 of 15
PostgreSQL - Performance Tuning
Which of the following SQL commands correctly shows the query plan including whether a sequential or index scan is used?
ADESCRIBE SELECT * FROM employees WHERE id = 5;
BSHOW PLAN SELECT * FROM employees WHERE id = 5;
CPLAN SELECT * FROM employees WHERE id = 5;
DEXPLAIN SELECT * FROM employees WHERE id = 5;
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct command for query plan

    In PostgreSQL, EXPLAIN shows the query plan including scan types.
  2. Step 2: Verify other options

    SHOW PLAN, PLAN, and DESCRIBE are not valid PostgreSQL commands for query plans.
  3. Final Answer:

    EXPLAIN SELECT * FROM employees WHERE id = 5; -> Option D
  4. Quick Check:

    Query plan command = D [OK]
Quick Trick: Use EXPLAIN to see scan type in PostgreSQL [OK]
Common Mistakes:
  • Using SHOW PLAN which is invalid
  • Confusing DESCRIBE with EXPLAIN
  • Trying PLAN command which doesn't exist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes