Bird
0
0

Given a table employees with an index on department_id, what will the Bitmap Index Scan do when you run:

medium📝 query result Q13 of 15
PostgreSQL - Performance Tuning
Given a table employees with an index on department_id, what will the Bitmap Index Scan do when you run:
EXPLAIN SELECT * FROM employees WHERE department_id = 5;?
AIt creates a bitmap of row locations where department_id = 5, then fetches those rows efficiently
BIt scans the entire table sequentially without using the index
CIt updates the rows where department_id = 5
DIt deletes rows where department_id = 5
Step-by-Step Solution
Solution:
  1. Step 1: Understand Bitmap Index Scan on condition

    The scan uses the index on department_id to find matching rows and creates a bitmap of their locations.
  2. Step 2: Explain how rows are fetched

    Using the bitmap, it fetches only those rows efficiently from the table, avoiding full scan.
  3. Final Answer:

    It creates a bitmap of row locations where department_id = 5, then fetches those rows efficiently -> Option A
  4. Quick Check:

    Bitmap Index Scan finds matching rows then fetches [OK]
Quick Trick: Bitmap Index Scan finds and fetches matching rows efficiently [OK]
Common Mistakes:
  • Thinking it scans the whole table sequentially
  • Confusing scan with update or delete operations
  • Assuming it fetches rows without bitmap

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes