CS FundamentalsModerateGATE
A table has 1,000,000 rows, and a column's selectivity (distinct values / total rows) is estimated as 1/100,000. Roughly how many rows would a query optimizer expect an equality predicate on this column to return, assuming uniform distribution?
- A. About 10 rows
- B. About 100,000 rows
- C. About 1 row
- D. About 1,000 rows
Correct answer: A. About 10 rows
Expected matching rows ≈ total rows × selectivity = 1,000,000 × (1/100,000) = 10. This simple uniform-distribution estimate is exactly what histograms are meant to improve on when the real data is skewed.
More DBMS and SQL questions
- A B+ tree index on a column is said to have a 'fan-out' of 100 (each internal node has up to 100 children). For a table with 10,000,000…
- Which of these is the best reason a database might choose to use a bitmap index rather than a B+ tree index on a column?
- Two transactions, T1 and T2, both want to update the same row. T1 acquires a shared (read) lock, then later tries to upgrade to an…
- A query uses SELECT ... FOR UPDATE to explicitly lock the rows it reads within a transaction. What is the main purpose of this, compared…
- A long-running read-only transaction under snapshot isolation sees a consistent view of the database as of its start time, even while…
- A relation R(A, B, C) has the single functional dependency A → B (C is independent, with no FD at all involving it, and no candidate key…