DBMS and Query Optimization. Flashcards

1
Q

Discuss basic database performance tuning concepts

A

Database performance-tuning: A set of activities and procedures designed to reduce the response time of a
database system.

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

what is SQL performance tuning

A

SQL performance tuning – on the client side – that will generate an SQL query to return the correct answer in
the least amount of time, using the minimum amount of resources at the server end.

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

what is DBMS performance tuning

A

DBMS performance tuning – on the server side – that will properly configure the DBMS environment to
respond to clients’ requests in the fastest way possible, while making optimum use of existing resources

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

Explain how the DBMS processes SQL queries - 1. Parsing

A

Parsing - The DBMS parses the SQL query and chooses the most efficient access/execution plan.

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

Explain how the DBMS processes SQL queries - 2. Execution

A

Execution - The DBMS executes the SQL query using the chosen execution plan.

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

Explain how the DBMS processes SQL queries - 3. Fetching

A

Fetching - The DBMS fetches the data and sends the result set back to the client.

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

Explain the role of indexes in speeding up data access - indexes

A

Indexes: Used to speed up data access by creating ordered sets of values that contain index keys and pointers
to actual table rows.

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

Explain the role of indexes in speeding up data access - Data sparsity

A

Data sparsity: It’s the variety of unique values in a column. Helps determine whether to use an index.
Low sparsity columns – Less suitable for indexing
High sparsity columns – Benefits from indexing

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

Different types of indexes:

A
  • Hash indexes: Used for fast lookups based on equality.
  • B-tree indexes: A balanced tree structure, ideal for columns with many unique values.
  • Bitmap indexes: Use bit arrays, suited for columns with few repeating values, common in data
    warehousing.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Discuss the query optimiser

A

Query optimisation: Crucial during the parsing phase of query processing, where a DBMS decides the best
approach to execute a query.

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

two types of query optimizers - 1. Rule-Based Optimizer

A

Rule-Based Optimizer: Uses predefined rules to determine the best approach to execute a query.

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

two types of query optimizers - 1. Rule-Based Optimizer

A

Cost-Based Optimizer: Uses statistics about database objects to determine the most efficient query
execution plan

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

Describe common practices used to write efficient SQL code

A
  • Numeric field comparisons are faster than character, date, and NULL comparisons
  • Equality comparisons are faster than inequality comparisons (>,<)
  • Transform conditional expressions to use literals (text or numbers instead of variables)
  • Write equality conditions first when using multiple conditional expressions
  • When using multiple AND conditions, write the condition most likely to be false first
  • When using multiple OR conditions, put the condition most likely to be true first
  • Avoid the use of NOT logical operator
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Formulate queries and tune the DBMS for optimal performance
Steps to formulate a query:

A
  1. Identify what columns and computations are required
  2. Identify source tables
  3. Determine how to join the tables
  4. Determine what selection criteria are needed
  5. Determine the order in which to display the output
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

SQL Performance Tuning

A

SQL performance tuning: Focuses on writing efficient SQL code from the client perspective, recognizing that
most modern relational DBMSs offer automatic query optimization.

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

Key Considerations: in SQL performance returning. - Automatic

A

Automatic Optimization: Most current-generation relational DBMSs automatically optimize queries,
but these optimizations are general and not tailored to the specific circumstances of query execution.

17
Q

Key Considerations: in SQL performance returning. - performance

A

Performance Impact: A well-structured SQL query can vastly outperform a poorly structured one,
addressing most performance issues related to SQL code.

18
Q

Database performance tuning

A

DBMS performance tuning: Includes managing memory allocation and physical storage to optimize database
performance.

19
Q

Key Tuning Areas in Database Performance Tuning

A
  • Data Cache: Configure data cache size to allow for maximum request servicing.
  • SQL Cache: Store parsed SQL statements to speed up repeated queries by using the same access plan.
  • Sort Cache: Allocate temporary storage for operations requiring sorting.
  • Optimizer Mode: Understand whether the DBMS uses a cost-based or rule-based optimizer, and manage
    statistics accordingly.
20
Q

what is an in-memory database system

A

In-Memory Database Systems: These systems store data in primary memory (RAM) to reduce disk access
bottlenecks, enhancing performance for modern applications.