0
0
DBMS Theoryknowledge~20 mins

Cost-based optimization in DBMS Theory - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cost-based Optimization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the main goal of cost-based optimization

What is the primary objective of cost-based optimization in a database management system?

ATo store query results permanently for faster future access
BTo execute queries as quickly as possible without considering resource usage
CTo randomly select a query plan to balance load across servers
DTo find the query execution plan with the lowest estimated resource usage
Attempts:
2 left
💡 Hint

Think about what 'cost' refers to in query execution.

📋 Factual
intermediate
2:00remaining
Components considered in cost estimation

Which of the following components is NOT typically considered by a cost-based optimizer when estimating the cost of a query plan?

ACPU usage required to process the query
BDisk I/O operations needed to read data
CNetwork latency between client and server
DMemory usage during query execution
Attempts:
2 left
💡 Hint

Consider what the optimizer controls directly during query execution.

🔍 Analysis
advanced
2:00remaining
Analyzing the effect of statistics on cost-based optimization

How do outdated or inaccurate statistics affect the decisions made by a cost-based optimizer?

AThey can cause the optimizer to choose inefficient query plans leading to slower execution
BThey have no effect since the optimizer uses fixed rules regardless of statistics
CThey cause the optimizer to skip cost estimation and use default plans
DThey improve optimization by forcing the optimizer to try multiple plans
Attempts:
2 left
💡 Hint

Think about how the optimizer estimates costs based on data distribution.

Comparison
advanced
2:00remaining
Comparing cost-based and rule-based optimization

Which statement best describes a key difference between cost-based and rule-based query optimization?

ACost-based optimization uses estimated resource costs to choose plans; rule-based uses fixed priority rules without cost estimation
BRule-based optimization always produces faster query plans than cost-based optimization
CCost-based optimization ignores data statistics while rule-based relies on them heavily
DRule-based optimization is more flexible and adapts to changing data distributions automatically
Attempts:
2 left
💡 Hint

Consider how each optimizer decides which plan to use.

Reasoning
expert
3:00remaining
Identifying the impact of join order on query cost

Given a query joining three tables A, B, and C, why does the order in which tables are joined affect the cost estimated by a cost-based optimizer?

ABecause the optimizer only supports joining tables in alphabetical order
BBecause different join orders can change the size of intermediate results, affecting CPU and I/O costs
CBecause join order does not affect cost; all orders produce the same result and cost
DBecause the database engine executes joins in parallel regardless of order
Attempts:
2 left
💡 Hint

Think about how intermediate data size influences resource use.