Query Optimization MCQs Flashcards

(27 cards)

1
Q

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

A

Process of improving query execution performance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

Minimize disk I/O

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

The number of rows in a table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

Proper indexing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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

A

Choosing the most selective condition first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A detailed description of how a query will be executed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

A

Network speed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A

Reduce data duplication

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which SQL clause is primarily used to filter records?

o A) SELECT
o B) FROM
o C) WHERE
o D) ORDER BY

A

WHERE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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

A

Query rewriting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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

A

Aggregates data based on specified columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A

Increased data redundancy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

Combining tables to improve performance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

A

Filters records after grouping

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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

A missing index

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

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

A

To improve query performance without changing semantics

17
Q

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

A

Shows the execution plan for a query

18
Q

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

A

Execution plan

19
Q

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

A

Left Outer Join

20
Q

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

A

Query planning

21
Q

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

A

Storing query results for faster retrieval

22
Q

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

23
Q

Which operation is typically more efficient with an indexed column?

o A) UPDATE
o B) DELETE
o C) SELECT
o D) INSERT

24
Q

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

25
What is a common reason for performance degradation in queries? ## Footnote o A) Proper indexing o B) High cardinality o C) Inefficient query plans o D) Data normalization
Inefficient query plans
26
Which optimization technique involves rewriting a query to improve performance? ## Footnote o A) Heuristic optimization o B) Query transformation o C) Query execution o D) Data modeling
Query transformation
27
What is a common effect of using too many indexes on a table? ## Footnote o A) Faster query performance o B) Slower data retrieval times o C) Increased update performance o D) Reduced database size
Slower data retrieval times