Query Processing & Optimization MCQs

Topic-wise practice questions for Database Management Systems. Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q1medium
A query plan shows a "Sequential Scan" on a table of 10 million rows, even though there is a WHERE id = 500 filter and an index on id exists. What could be a technical reason for this?
Q2easy
What is the difference between Materialization and Pipelining in the context of query execution?
Q3hard
(Calculation/Logic) The optimizer is evaluating an INNER JOIN between Table A (1,000 rows) and Table B (1,000,000 rows). Which join order is it most likely to attempt to minimize memory usage for a Hash Join?
Q4hard
A heuristic-based query optimizer encounters a query joining three large tables. Which rule is it most likely to apply first to reduce the overall execution time?
Q5medium
During the Query Translation phase, into which mathematical representation is a declarative SQL statement typically converted?
Q6medium
Analyze the output of the EXPLAIN command below. What does the "cost" value (e.g., 0.00..10.50) represent to the optimizer? postgres - plan_analyzer

EXPLAIN SELECT * FROM users WHERE id = 1;
-- Output:
Q7medium
In a Cost-Based Optimizer (CBO), where does the engine retrieve the information needed to estimate the cost of a plan (e.g., number of rows, distinct values)?
Q8medium
A query that was previously fast suddenly becomes extremely slow after 1 million new rows are inserted into the table, even though an index exists. What is the most likely cause?
Q9hard
Why is the Join Order one of the most complex parts of query optimization?
Q10medium
A developer notices that a query using SELECT * is slower than SELECT id, name. From a query processing perspective, why is this?