All Questions
Database Indexing medium

Under what condition will the PostgreSQL/MySQL query optimizer ignore an available B-Tree index for a `SELECT` query?

  1. A When the query returns a large percentage of the table rows (low selectivity), making a Sequential Scan faster than random I/O index seeks.
  2. B When the table exceeds a specific, internal size threshold (typically more than one million rows) that makes B-Tree traversal inefficient.
  3. C Whenever the query involves a multi-table JOIN operation that requires the database to synchronize locks across several disparate partitions.
  4. D If the targeted column is defined as a variable-length `VARCHAR`, as the optimizer prefers numeric identifiers for all index-based operations.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions