Query Optimization MCQs Flashcards
(27 cards)
What is query optimization?
o A) Process of executing a query
o B) Process of improving query execution performance
o C) Process of designing a database schema
o D) Process of data retrieval
Process of improving query execution performance
Which of the following is a goal of query optimization?
o A) Minimize disk I/O
o B) Maximize network latency
o C) Increase query complexity
o D) Minimize memory usage
Minimize disk I/O
What does the term “cardinality” refer to in query optimization?
o A) The number of attributes in a table
o B) The number of rows in a table
o C) The complexity of a query
o D) The number of indexes on a table
The number of rows in a table
Which of the following can improve query performance?
o A) Using SELECT *
o B) Proper indexing
o C) Avoiding WHERE clauses
o D) Using subqueries exclusively
Proper indexing
Which of the following is a heuristic optimization strategy?
o A) Choosing the most selective condition first
o B) Calculating the total cost of execution plans
o C) Using random sampling
o D) Analyzing data distribution
Choosing the most selective condition first
What is an execution plan?
o A) A diagram of the database schema
o B) A detailed description of how a query will be executed
o C) A list of indexes on a table
o D) A set of stored procedures
A detailed description of how a query will be executed
Which of the following is NOT a factor in query optimization?
o A) Query structure
o B) Database size
o C) Network speed
o D) Indexing strategy
Network speed
What does “normalization” aim to achieve?
o A) Increase data redundancy
o B) Reduce data duplication
o C) Simplify complex queries
o D) Optimize indexing
Reduce data duplication
Which SQL clause is primarily used to filter records?
o A) SELECT
o B) FROM
o C) WHERE
o D) ORDER BY
WHERE
Which of the following is a common query optimization technique?
o A) Denormalization
o B) Redundant data storage
o C) Query rewriting
o D) Ignoring indexes
Query rewriting
What does the “GROUP BY” clause do?
o A) Sorts the result set
o B) Aggregates data based on specified columns
o C) Filters records
o D) Joins multiple tables
Aggregates data based on specified columns
Which of the following is NOT a benefit of using indexes?
o A) Faster data retrieval
o B) Reduced query execution time
o C) Increased data redundancy
o D) Improved sorting performance
Increased data redundancy
What is “denormalization”?
o A) Reducing data redundancy
o B) Increasing data normalization
o C) Combining tables to improve performance
o D) Splitting tables for efficiency
Combining tables to improve performance
What does the “HAVING” clause do?
o A) Filters records before grouping
o B) Filters records after grouping
o C) Joins tables
o D) Sorts the result set
Filters records after grouping
Which of the following can cause a full table scan?
o A) An indexed column in the WHERE clause
o B) A missing index
o C) A simple SELECT query
o D) A JOIN on indexed columns
A missing index
What is the purpose of query rewriting?
o A) To change the database schema
o B) To improve query performance without changing semantics
o C) To add complexity to queries
o D) To create new tables
To improve query performance without changing semantics
In SQL, what does “EXPLAIN” do?
o A) Executes a query
o B) Shows the execution plan for a query
o C) Analyzes data distribution
o D) Creates indexes
Shows the execution plan for a query
Which of the following can be used to analyze query performance?
o A) Query history
o B) Execution plan
o C) Data redundancy
o D) Data types
Execution plan
Which type of join returns all rows from the left table?
o A) Inner Join
o B) Left Outer Join
o C) Right Outer Join
o D) Cross Join
Left Outer Join
Which of the following is an aspect of the query optimization process?
o A) Query execution
o B) Query planning
o C) Query debugging
o D) Query storage
Query planning
What is “query caching”?
o A) Storing query results for faster retrieval
o B) Storing indexes on disk
o C) Increasing data redundancy
o D) Creating temporary tables
Storing query results for faster retrieval
Which SQL keyword is used to remove duplicate rows from a result set?
o A) UNIQUE
o B) DISTINCT
o C) DIFFERENT
o D) REMOVE
DISTINCT
Which operation is typically more efficient with an indexed column?
o A) UPDATE
o B) DELETE
o C) SELECT
o D) INSERT
SELECT
Which of the following is NOT a type of JOIN in SQL?
o A) Inner Join
o B) Outer Join
o C) Cartesian Join
o D) Logical Join
Logical Join