CS FundamentalsHardProduct-company placement · GATE CS
A table has 1,000,000 rows stored 20 per block. An unclustered B+ tree index fetches each matching row with one random block read (ignore index traversal). Above roughly what selectivity is a full table scan cheaper than using the index?
- A. 20%
- B. 2%
- C. 50%
- D. 5%
Correct answer: D. 5%
The scan reads 1,000,000 / 20 = 50,000 blocks; the index costs about one read per matching row, so it loses once matches exceed 50,000 rows, i.e. 5% = 1 / (rows per block). Optimisers therefore skip unclustered indexes for even moderately selective predicates.
More DBMS and SQL questions
- R(A, B) = {(1, x), (2, y), (3, z)} and S(B, C) = {(x, 5), (x, 6), (w, 7)}. How many tuples are in the natural full outer join of R and S?
- Customer(cid, city) LEFT OUTER JOIN Orders(oid, cid, amt) on cid is followed by the selection amt > 100. An optimiser wants to push this…
- An ER diagram has Student (key roll, multivalued attribute phone), Course (key cid) and Faculty (key fid). Enrols is many-to-many between…
- R has 2000 tuples with 100 distinct values of attribute b; S has 5000 tuples with 250 distinct values of b. Assuming uniform values and…
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…