Query Processing and Optimization - algorithms for query processing, query optimization - One Line Questions
1.
What is a 'query block' or 'subquery' in the context of optimization? —
A part of a larger query that can be optimized independently
2.
What is an 'index' in a database context? —
A data structure that improves the speed of data retrieval operations on a database table
3.
What is the 'System R' style of query optimization? —
A top-down approach using dynamic programming
4.
What is a 'heuristic' in the context of query optimization? —
5.
In dynamic programming for query optimization, what is the principle of optimality? —
An optimal plan for a query is composed of optimal sub-plans
6.
What is 'query decomposition' in query optimization? —
Breaking down a complex query into simpler sub-queries or operations
7.
What is the basic idea behind the Nested Loop Join algorithm? —
For each row in the outer relation, scan the entire inner relation
8.
What is the 'probe' phase in Hash Join? —
Using the hash table built on one relation to find matches in the other relation
9.
Which of the following is an example of a 'physical' optimization choice? —
Choosing between different join algorithms (e.g., Hash Join vs. Sort-Merge Join)
10.
What is a 'Cartesian Product' (or Cross Join)? —
Combines every row from the first table with every row from the second table
11.
What is 'view materialization' in query optimization? —
Storing the results of a view query to avoid recomputing it
12.
Which of the following is a common algorithm used in query optimization? —
Dynamic Programming
13.
Which of the following is a common type of join optimization? —
Choosing the best join algorithm
14.
What is 'data localization' in the context of distributed query processing? —
Minimizing data transfer between sites by processing data close to where it is stored
15.
What is 'query pipelining'? —
Allowing the output of one operation to be consumed by the next operation without waiting for the first to complete entirely
16.
When would a Hash Index be more beneficial than a B+ Tree Index? —
For queries involving equality comparisons on the indexed attribute
17.
Which type of index is commonly used in relational databases for efficient range queries and ordered retrieval? —
B+ Tree Index
18.
Which type of query optimization aims to find the absolute best execution plan, even if it takes a long time? —
Exhaustive Optimization
19.
Which of the following is a common operation in relational algebra used in query processing? —
Join
20.
What is the primary advantage of using a B+ Tree index for joins? —
It supports efficient ordered traversal, which can be used for sort-merge joins
21.
What is the main drawback of exhaustive query optimization? —
It can be computationally very expensive and time-consuming for complex queries
22.
What is the main advantage of Hash Join? —
It can be very efficient for large relations, especially with sufficient memory
23.
Consider a query 'SELECT * FROM Students WHERE GPA > 3.5;'. Which operation does this primarily represent? —
Selection
24.
Which of the following is a common challenge in distributed query optimization? —
High network latency and bandwidth limitations
25.
Which of the following is a common data structure used to speed up selections and joins? —
B-Tree
26.
Which join algorithm is generally efficient when both relations are sorted on the join attribute? —
Sort-Merge Join
27.
Which of these statistics are crucial for estimating the cost of a selection operation? —
All of the above
28.
Which of the following is NOT a phase of query processing? —
Data Entry
29.
Consider the relational algebra expression (R JOIN S) WHERE condition. Which is generally a better optimization strategy? —
Perform the WHERE first, then the JOIN
30.
In Hash Join, what is the 'build' phase? —
Creating a hash table on the smaller relation
31.
What is 'predicate pushdown'? —
Pushing a selection predicate down to an earlier stage in the query plan, ideally to the data source
32.
Which component is responsible for transforming a high-level query language statement into an internal representation? —
Parser
33.
Which operation is used to reduce the number of columns in a query result? —
Projection
34.
Consider a query 'SELECT Name, Age FROM Students;'. Which operation does this primarily represent? —
Projection
35.
What does a 'join' operation typically do? —
Combines rows from two or more tables based on a related column
36.
Which optimization technique involves executing parts of a query in parallel across multiple processors? —
Parallel Query Execution
37.
Which join algorithm is typically efficient when one relation is significantly smaller than the other? —
Index Nested Loop Join
38.
What is the output of the query parsing and translation phase? —
An intermediate representation like a relational algebra tree or query graph
39.
Which of the following is a key factor considered during query optimization? —
The size of the database and available indexes
40.
What is 'cost-based optimization'? —
To estimate the cost of various query plans and select the one with the lowest estimated cost
41.
What is a 'semi-join' operation used for in distributed query processing? —
To reduce the size of one relation by sending only the necessary rows to another site for join processing
42.
What is the purpose of the 'selection' operation in relational algebra? —
To filter rows based on a condition
43.
What is a 'cost model' used for in query optimization? —
To estimate the resource consumption (e.g., I/O, CPU) of different query plans
44.
What is the primary function of the query optimization phase? —
To find the most efficient execution plan for a given query
45.
What is the goal of 'rule-based optimization'? —
To apply a set of predefined transformation rules to rewrite the query into an equivalent but more efficient form
46.
What is the purpose of the parsing phase in query processing? —
To check for syntax errors and translate SQL into a relational algebra expression
47.
Why is it generally better to apply selection operations as early as possible in a query plan? —
To reduce the number of rows that need to be processed by subsequent operations
48.
What is the primary goal of query processing? —
To retrieve data as quickly as possible
49.
What is the role of statistics in query optimization? —
To provide information about the data distribution and size of tables and indexes, used for cost estimation
50.
When is Nested Loop Join most efficient? —
When one relation is small and the other is indexed on the join attribute