opt Flashcards

(27 cards)

1
Q

What is query optimization?

A

Process of improving query execution performance

Query optimization focuses on enhancing the efficiency of executing database queries.

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?

A

Minimize disk I/O

Reducing disk input/output operations can significantly enhance performance.

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?

A

The number of rows in a table

Cardinality is a critical factor in understanding query performance.

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?

A

Proper indexing

Proper indexing allows the database to quickly locate the requested data.

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?

A

Choosing the most selective condition first

This strategy aims to minimize the result set early in the query execution.

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

What is an execution plan?

A

A detailed description of how a query will be executed

Execution plans help database administrators understand query performance.

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?

A

Network speed

While network speed can affect overall performance, it is not a direct factor in query optimization.

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

What does ‘normalization’ aim to achieve?

A

Reduce data duplication

Normalization is essential for ensuring data integrity in databases.

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?

A

WHERE

The WHERE clause is crucial for specifying conditions in SQL queries.

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?

A

Query rewriting

Query rewriting involves modifying queries for better performance without changing their meaning.

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

What does the ‘GROUP BY’ clause do?

A

Aggregates data based on specified columns

GROUP BY is commonly used with aggregate functions like SUM or COUNT.

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?

A

Increased data redundancy

Indexes are intended to optimize performance rather than increase redundancy.

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

What is ‘denormalization’?

A

Combining tables to improve performance

Denormalization can enhance read performance at the cost of write performance.

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

What does the ‘HAVING’ clause do?

A

Filters records after grouping

HAVING is used in conjunction with GROUP BY to filter aggregated results.

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?

A

A missing index

A full table scan occurs when no indexes are available to optimize the query.

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

What is the purpose of query rewriting?

A

To improve query performance without changing semantics

This technique can lead to more efficient execution plans.

17
Q

In SQL, what does ‘EXPLAIN’ do?

A

Shows the execution plan for a query

The EXPLAIN command provides insight into how a SQL query will be executed.

18
Q

Which of the following can be used to analyze query performance?

A

Execution plan

An execution plan outlines the steps the database will take to execute a query.

19
Q

Which type of join returns all rows from the left table?

A

Left Outer Join

Left Outer Join includes unmatched rows from the left table in the result.

20
Q

Which of the following is an aspect of the query optimization process?

A

Query planning

Query planning involves determining the most efficient way to execute a query.

21
Q

What is ‘query caching’?

A

Storing query results for faster retrieval

Query caching can significantly speed up repeated query executions.

22
Q

Which SQL keyword is used to remove duplicate rows from a result set?

A

DISTINCT

DISTINCT ensures that only unique rows are returned in the result set.

23
Q

Which operation is typically more efficient with an indexed column?

A

SELECT

Indexes enhance the performance of SELECT operations by allowing quicker lookups.

24
Q

Which of the following is NOT a type of JOIN in SQL?

A

Logical Join

Logical Join is not a recognized type of JOIN in SQL; valid types include Inner, Outer, and Cartesian Joins.

25
What is a common reason for performance degradation in queries?
Inefficient query plans ## Footnote Poorly optimized query plans can lead to slower execution times.
26
Which optimization technique involves rewriting a query to improve performance?
Query transformation ## Footnote Query transformation is a critical part of query optimization strategies.
27
What is a common effect of using too many indexes on a table?
Slower data retrieval times ## Footnote While indexes speed up reads, too many can slow down writes and updates.