Bird
0
0

What will be the output of this EXPLAIN query?

medium📝 query result Q5 of 15
PostgreSQL - Performance Tuning
What will be the output of this EXPLAIN query?
EXPLAIN SELECT * FROM orders WHERE order_date > '2023-01-01';

Assuming 'order_date' is not indexed and the table has 500,000 rows.
AIt will show a sequential scan on the orders table.
BIt will show an index scan on the orders table.
CIt will show a bitmap index scan on the orders table.
DIt will return an error because order_date is not indexed.
Step-by-Step Solution
Solution:
  1. Step 1: Check index presence

    Since 'order_date' is not indexed, PostgreSQL cannot use an index scan.
  2. Step 2: Determine scan type

    PostgreSQL will perform a sequential scan to check all rows for the condition.
  3. Final Answer:

    It will show a sequential scan on the orders table. -> Option A
  4. Quick Check:

    Scan type without index = A [OK]
Quick Trick: No index means sequential scan by default [OK]
Common Mistakes:
  • Expecting index scan without an index
  • Confusing bitmap index scan with index scan
  • Thinking query errors without index

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes