← RGPV CS-502 DBMS December 2024 solved question paper
← RGPV CS-502 DBMS November 2023 solved question paper
← RGPV CS-502 DBMS November 2022 solved question paper
← RGPV CS-502 DBMS December 2020 solved question paper
← RGPV CS-502 DBMS June 2026 solved question paper
← RGPV CS-502 DBMS June 2025 solved question paper
← RGPV CS-502 DBMS November 2019 solved question paper
RGPV Previous Year Examination Question
B.Tech. V Semester | CS-502 (GS) | December 2024 | 4(b)
Question (restated): Write a short explanation of query optimization.
Answer

Definition
Query optimization is the process of selecting an efficient execution plan for a database query without changing its logical result. A single SQL statement can be evaluated through many equivalent plans, whose execution costs may differ substantially.
Stages
First, parsing and semantic analysis validate the query and translate it into an internal representation. Logical optimization applies equivalence rules, such as pushing selections closer to base relations and eliminating unnecessary attributes. Physical optimization chooses access paths, join algorithms and join order. The optimizer estimates costs using catalog statistics and selects a promising plan.
Example
SELECT S.Name FROM Student S JOIN Department D ON S.DeptID = D.DeptID WHERE D.DeptName = 'CSE';
Suppose Student has 10,000 rows and Department has 100 rows, only one of which represents CSE. Filtering Department before joining can reduce the intermediate relation considerably. An index on Student.DeptID may allow the engine to retrieve only matching students. These numbers are illustrative; the best plan depends on selectivity, indexes and storage costs.
Optimization techniques
Selection pushdown reduces intermediate tuples. Projection pushdown removes unnecessary columns while retaining required join attributes. Join reordering exploits associativity and commutativity of inner joins where valid. Index scans may replace full scans for selective predicates. Hash joins, merge joins and nested-loop joins are selected according to input sizes, ordering and available memory.
Cost-based optimization estimates disk I/O, CPU and memory requirements. Rule-based transformations use algebraic equivalences. Modern optimizers commonly combine both approaches. Optimization improves response time and resource utilization, although inaccurate statistics may lead to a suboptimal plan.
Further reading
Silberschatz, Korth and Sudarshan, Database System Concepts; Elmasri and Navathe, Fundamentals of Database Systems.
RGPV CS-502 (GS) | November 2023 | Q4(a) | 7 marks
Question (restated): Explain major query optimization stages and the selection cascade rule.
Additional examination answer
The selection cascade rule splits a conjunction into a sequence of selections: σ(p AND q)(R) = σp(σq(R)). Selection operations can be reordered when predicates are deterministic and applicable to the same relation. This permits selective predicates to be applied early, reducing intermediate results.
For example, to retrieve employees in department 10 earning over 5000, the optimizer may apply the department condition first if an index exists, then test salary on the smaller result. For a join, a predicate referencing only one input can often be pushed below an inner join. Such transformations preserve the result while reducing I/O and CPU work. Outer joins and SQL NULL semantics require care.
The optimization process includes parsing and validation, translation into relational algebra, logical rewriting, enumeration of physical alternatives, estimation of costs using statistics, and selection of an execution plan. Cost estimation is not exact: skew, correlated attributes and stale statistics can lead to poor plans.
Further reading: Silberschatz, Korth and Sudarshan, Database System Concepts; Elmasri and Navathe, Fundamentals of Database Systems.
RGPV CS-502 (GS) | November 2022 | Q4(a) | 7 marks
Question (restated): Explain three major stages of query optimization.
Answer
Query optimization selects an efficient execution plan for a declarative query without changing its result. A useful three-stage classification is logical translation and rewriting, physical plan enumeration, and cost estimation and selection.
1. Logical translation and rewriting
The parser checks syntax, resolves names and validates types. SQL is translated into a logical operator tree. Equivalent transformations push filters below joins, eliminate unnecessary columns and simplify predicates. These transformations reduce intermediate relations while preserving semantics.
2. Physical alternatives
The optimizer enumerates alternative access paths and join algorithms: sequential scans, index scans, nested-loop joins, hash joins and sort-merge joins. It also considers join order. A small selective input may make indexed nested loops efficient, while large equijoins may favor hashing.
3. Cost estimation and plan selection
Catalog statistics estimate cardinalities, page reads, CPU operations and memory needs. The optimizer compares alternatives and selects a low estimated cost plan. Estimates may be inaccurate if statistics are stale or attributes correlated.
SELECT E.E_Name FROM Employee E JOIN Department D ON E.Dept_ID=D.Dept_ID WHERE D.Dept_ID=101;
For an illustrative 10,000-row Employee table with 100 rows per page, a full scan reads about 100 data pages. If an index retrieves a few qualifying rows, fewer pages may be accessed. Actual cost depends on clustering, cache and selectivity. The selected physical plan is passed to the execution engine.
Further reading: Silberschatz, Korth and Sudarshan, Database System Concepts.
December 2020 examination question
Explain the principle of query optimization.
Query optimization chooses an efficient execution plan from equivalent alternatives. A logical plan can push selections and projections toward base relations and reorder joins when equivalence rules permit. A physical plan chooses access paths and join algorithms. For example, filtering employees by department before joining with Department can reduce intermediate rows. Cost estimates use statistics such as cardinality, selectivity, page counts and available indexes. The optimizer compares estimated I/O, CPU and communication costs; inaccurate statistics may produce poor plans.
Further reading: Silberschatz, Korth and Sudarshan, Database System Concepts.
June 2026 examination: additional answer
RGPV CS-502 (GS) | June 2026 | Q6(a) | 7 marks (inferred)
Question (restated): Explain query optimization and query evaluation plans.
Answer

Query optimization selects an efficient execution strategy for a declarative query. Parsing checks syntax and resolves names; translation produces a logical operator tree; rewriting generates equivalent logical forms; physical planning selects access paths, join order and algorithms. Execution then runs the chosen plan.
For SELECT S.Name FROM Student S JOIN Department D ON S.DeptID=D.DeptID WHERE D.DeptName=’CSE’, one plan joins all rows and filters afterward. Another filters Department first, then joins matching rows and projects Name. The latter may reduce intermediate data. A physical plan may use a sequential scan, index scan, nested-loop join, hash join or merge join.
Suppose Student occupies 1000 pages and Department 10 pages. A simple block nested-loop join with Department as outer and 5 available buffers costs approximately 10 + ceil(10/3)×1000 = 4010 page reads, ignoring output and caching. Filtering Department to one materialized page could reduce join reads to about 1001, plus filtering and materialization costs. Actual costs depend on memory, indexes and data distribution.
The optimizer estimates cardinality using statistics, histograms and selectivity assumptions. It compares candidate plans under a cost model that may include CPU, I/O and network transfer. EXPLAIN displays the selected plan; execution analysis can reveal estimation errors. Stale statistics and correlated predicates can cause poor choices.
Optimization preserves query semantics, including null handling and duplicates. The best estimated plan is not guaranteed to be the fastest actual plan.
June 2025 – Q6(b)
Explain the phases involved in query optimization.
Parsing and validation check syntax, names and types. Translation produces a logical operator tree. Logical rewriting applies equivalences such as selection pushdown and projection pruning. Plan enumeration considers join orders, indexes and physical algorithms. Cost estimation uses statistics, cardinality estimates, I/O and CPU models. Plan selection chooses a low estimated cost plan, which the execution engine runs. For Student joined with Enrollment and a selective Marks predicate, filtering Student first can reduce join input. Statistics errors can lead to poor plans; EXPLAIN helps inspect choices. Parsing and execution surround optimization in the broader query-processing pipeline.
https://easyexamnotes.com/wp-content/uploads/2026/12/dbms-query-optimization-jun2025.png
November 2019 – Question 4(b)
Question (restated): Illustrate and explain the steps of query processing.
Answer
Query processing begins with parsing and semantic validation, then translation to a logical relational expression. Rewriting applies equivalences such as pushing selections below joins. The optimizer estimates cardinalities and costs and chooses physical operators such as index scans and hash joins. The execution engine runs the plan using the buffer and storage managers and returns results. For SELECT name FROM Student WHERE marks > 60, a selective indexed predicate may favor an index scan; otherwise a sequential scan may be cheaper.

← RGPV CS-502 DBMS December 2024 solved question paper
← RGPV CS-502 DBMS November 2023 solved question paper
← RGPV CS-502 DBMS November 2022 solved question paper
← RGPV CS-502 DBMS December 2020 solved question paper
← RGPV CS-502 DBMS June 2026 solved question paper
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion