CS FundamentalsModerateTCS NQT · Infosys pattern

A table is partitioned by RANGE on a date column (e.g. one partition per year). A query filters `WHERE sale_date BETWEEN '2023-01-01' AND '2023-12-31'`. What optimization does the query planner typically apply, called 'partition pruning'?

  1. A. It converts the range partitioning into hash partitioning at query time
  2. B. It scans every partition anyway, since partitioning doesn't help filtering
  3. C. It identifies, from the query's date range, which partition(s) COULD possibly contain matching rows and skips scanning the other partitions entirely
  4. D. It merges all partitions back into a single table before executing the query

Correct answer: C. It identifies, from the query's date range, which partition(s) COULD possibly contain matching rows and skips scanning the other partitions entirely

Partition pruning uses the partitioning scheme's boundaries (known at plan time) to determine that only the 2023 partition can possibly satisfy a 2023-only date filter, so the other partitions (other years) are never even opened or scanned — a major I/O saving for well-partitioned, time-series-style tables.

More DBMS and SQL questions

Exams that ask this topic