Query Execution and Optimization
- 54Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
54 questions
- 1Before execution, an SQL query is converted into a relational algebra_____.
Hint
Think of the tree-shaped representation of the query's operations.
Answer
expression tree
- 2The operators in a relational algebra expression tree are executed using appropriate_____.
Hint
These are alternative procedures for carrying out operations such as joins.
Answer
algorithms
- 3Before executing a query, the initial relational algebra expression is rewritten in a way that preserves its_____.
Hint
The transformed expression must return the same result as the original.
Answer
meaning
- 4Meaning-preserving query rewrites can use heuristics and_____transformations.
Hint
These transformations use the laws of relational algebra.
Answer
algebraic
- 5Rewriting an expression into a form more suitable for execution is called heuristic or algebraic_____.
Hint
This process improves the expression before selecting specific execution methods.
Answer
optimization
- 6After the final relational algebra tree is generated, the optimizer estimates operator costs in a step called_____query optimization.
Hint
This optimization compares estimated costs of alternative methods.
Answer
cost based
- 7An execution plan specifies which_____will be used for each operator in the query.
Hint
The plan fixes how each operation will be carried out.
Answer
method
- 8A central heuristic is to push selection and projection operations as close as possible to the_____of the relational algebra tree.
Hint
These are the bottom nodes, where base relations appear.
Answer
leaves
- 9In a relational algebra tree, the leaf nodes normally contain the database's base_____.
Hint
These are the underlying tables used by the query.
Answer
relations
- 10Pushing selections toward the leaves reduces the number of tuples entering later operations, making intermediate results_____.
Hint
Filtering early means fewer records have to be processed downstream.
Answer
smaller
- 11Pushing projections toward the leaves reduces the number of_____carried in intermediate results.
Hint
Projection keeps selected attributes rather than all attributes.
Answer
fields
- 12The results produced at internal nodes of a relational algebra tree are called_____results.
Hint
They are produced before the final query result.
Answer
intermediate
- 13If a conjunction contains multiple selection conditions, the conditions can be applied in any_____.
Hint
The selection operations can be rearranged without changing the result.
Answer
order
- 14When two selections are applied, their order can be changed because selection is_____.
Hint
This algebraic property allows the order of the two operations to be swapped.
Answer
commutative
- 15The join expressions A join B and B join A illustrate the commutative property of_____.
Hint
The operation combines tuples from two relations.
Answer
join
- 16Associativity allows a sequence of joins such as A join B join C to be_____in different groupings.
Hint
The relations can be combined with different parentheses while preserving the result.
Answer
written
- 17A selection condition involving only one relation can be pushed down to that relation's_____in the tree.
Hint
Apply the condition close to the input it concerns.
Answer
operand
- 18A cross product followed by a selection on the combined relations can be replaced by a_____.
Hint
This combined relational operation uses the selection condition to match tuples.
Answer
join
- 19In the example query, a predicate involving all three relations cannot be pushed down to just one relation because it depends on_____relations.
Hint
The predicate needs information from professor, teaching, and enrollment.
Answer
all three
- 20A relational algebra operator such as a join may have several applicable_____for its evaluation.
Hint
For example, different join procedures may be available.
Answer
algorithms
- 21A cost function estimates the work required to use a particular operator_____.
Hint
It evaluates the expected expense of one way of performing the operation.
Answer
method
- 22The number of block accesses performed by an algorithm can be used to estimate its_____.
Hint
This measures the resources the method is expected to consume.
Answer
cost
- 23Cost estimates can depend on the sizes of both operands and on the availability of_____.
Hint
These data structures can affect how efficiently records are found.
Answer
indexes
- 24Choosing a method for one operator can affect choices elsewhere because operators in the tree are_____.
Hint
A decision in one part of the plan may constrain or change another decision.
Answer
interdependent
- 25Because operator choices affect one another, the optimizer must consider them in a_____manner.
Hint
The choices should be evaluated as parts of one overall problem.
Answer
combined
- 26Finding the best combination of operator methods is described as an_____problem.
Hint
The problem is difficult enough that practical optimizers rely on shortcuts.
Answer
intractable
- 27Since exact optimization is difficult, query optimizers rely heavily on_____.
Hint
These are practical rules that guide the search for a good plan.
Answer
heuristics
- 28The overall estimated plan cost is based on the estimated costs of the chosen methods for the plan's_____.
Hint
Each relational algebra operation contributes to the plan's total estimate.
Answer
operators
- 29A cost-based optimizer selects the plan with the best estimated_____.
Hint
The optimizer compares the predicted expense of candidate plans.
Answer
cost
- 30Cost-based optimizers can make poor choices because their decisions rely on_____rather than exact knowledge of future execution.
Hint
Predicted costs may not match what happens with the actual data.
Answer
estimates
- 31In the example, the query seeks professor names and phone details for professors who taught a course taken by a student with a specified_____.
Hint
This value identifies the student whose enrollment is checked.
Answer
roll number
- 32The example query uses the Professor, Teaching, and_____relations.
Hint
This relation records which students are registered for courses.
Answer
Enrollment
- 33The professor's teaching assignment is matched to a student's enrollment using the shared_____.
Hint
This attribute identifies the course in both relations.
Answer
courseId
- 34The professor relation is connected to the teaching relation by matching their_____.
Hint
This attribute identifies the professor who teaches the course.
Answer
employeeId
- 35The example restricts both enrollment and teaching records to the_____semester.
Hint
The query specifies one of the two semester categories.
Answer
even
- 36The example also restricts the relevant enrollment and teaching records to the year_____.
Hint
This is the year specified in the query conditions.
Answer
2010
- 37The initial relational algebra expression represents the three relations with a cross product, applies a selection using the full condition, and then uses a_____for the requested attributes.
Hint
This operation keeps only selected attributes in the output.
Answer
projection
- 38Because the example's where conditions are a conjunction, they can be broken into separate_____.
Hint
Each individual condition can be considered and placed separately.
Answer
predicates
- 39The predicate on the student's roll number applies directly to the_____relation.
Hint
The student's course registration records contain the roll number.
Answer
Enrollment
- 40The example separates the employee identifier match from the course identifier match so each join condition can be placed with the appropriate_____.
Hint
Each condition concerns a particular pair of inputs.
Answer
relations
- 41After filtering Enrollment in the example, only courseId needs to be projected from it because that is the attribute required by the later_____.
Hint
The remaining operation matches enrollment courses with courses being taught.
Answer
join
- 42After filtering Teaching, the example retains courseId and employeeId because both are needed by later_____.
Hint
One attribute links courses, while the other links the professor.
Answer
joins
- 43From Professor, the example retains employeeId, name, and phone because they are needed for joining or the final_____.
Hint
Some attributes identify the professor, while others are requested by the query.
Answer
output
- 44A projection should avoid carrying an attribute upward if it will not be needed by any later operation or the final_____.
Hint
Keep only attributes that contribute to something the query must produce.
Answer
result
- 45Applying selection and projection while records are being read combines work instead of writing a filtered relation and processing it later; this uses_____.
Hint
The operations are applied as a stream of records moves through the plan.
Answer
pipelining
- 46An intermediate relation that fits in memory is generally better kept_____rather than materialized.
Hint
Avoid writing temporary results to storage when they can be handled in available working space.
Answer
in memory
- 47Materializing an intermediate table may be necessary when it cannot be handled in_____.
Hint
This is the working space in which a small intermediate result can be kept.
Answer
memory
- 48Compiled queries are known in advance because they are part of database_____.
Hint
These are organized pieces of work that carry out logical requests.
Answer
transactions
- 49Because compiled queries are known beforehand, their plans can be optimized and fixed_____.
Hint
The optimization can occur before the query is run.
Answer
offline
- 50Compiled queries can justify spending more time on optimization because they may be executed_____of times.
Hint
The plan may be reused repeatedly rather than run only once.
Answer
hundreds
- 51An ad hoc query is a new query supplied by a user, such as an analyst working at a_____.
Hint
The user enters the query directly rather than relying on a precompiled one.
Answer
terminal
- 52Ad hoc queries often need quick optimization because the user is expecting_____results.
Hint
The query is new, and the user does not want to wait for extensive plan search.
Answer
fast
- 53Extensive optimization has a performance_____of its own.
Hint
Optimization consumes time and resources before query execution.
Answer
penalty
- 54To limit optimization overhead for ad hoc queries, a system may use_____versions of optimization.
Hint
These approaches perform less optimization work than a thorough offline search.
Answer
lighter

Ask anything
We've read this whole study set, so questions about it get the best answers.