Query Optimization Flashcards

(51 cards)

1
Q

is the process of selecting the most efficient query-evaluation plan from among the many strategies usually possible for processing a given query, especially if the query is complex.

A

Query Optimization

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

to find an expression that is equivalent to the given expression, but more efficient to execute.

A

relational-algebra level

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

defines exactly what algorithm should be used for each operation and how the execution of the operations should be coordinated.

A

Evaluation plan

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

provide a way to view the evaluation plan chosen to execute
a given query.

A

databases

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

displays the execution plan chosen for the specified query <query>.</query>

A

explain <query></query>

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

the command stores the resultant plan in a table called plan table, instead of displaying it.

A

explain plan for

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

displays the stored plan

A

select * from table

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

DB2 follows a simil arapproach to Oracle, but requires this program to be executed to display the stored plan.

A

db2exfmt

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

to be executed before
submitting the query; then, when a query is submitted, instead of executing the query, the evaluation plan is displayed.

A

set showplan_text

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

are said to be equivalent if on every legal database the
two expressions generate the same multiset of tuples.

A

multiset relational algebra

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

states that two relational-algebra expressions are equivalent and can replace each other since they always produce the same result on any valid database.

A

equivalence rule

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

Query optimizers use these rules to transform expressions into more efficient but logically equivalent forms.

A

equivalence rule

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

operations are associative

A

Natural-join

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

A set of equivalence rules is this if no rule can be derived from the others.

A

minimal

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

can be deconstructed into a sequence of individual selections.

A

Conjunctive selection

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

is important for reducing the size of temporary results

A

Join Ordering

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

the number of tuples in the relation r

A

nr

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

the number of blocks containing tuples of relation r.

A

br

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

the size of a tuple of relation r in bytes.

A

lr

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

the blocking factor of relation r—that is, the number of tuples of relation r that
f t into one block.

A

fr

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

the number of distinct values that appear in the relation r for attribute A.

22
Q

the values for the attribute are divided into a number of ranges, and with each range the histogram associates the number of tuples whose attribute value lies in that range.

23
Q

divides the range of values into equal-sized ranges

A

equi-width histogram

24
Q

adjusts the boundaries of the ranges such that each range has the same number of values.

A

equi-depth histogram

25
generates statistics on specified relations, or on all relations.
analyze
26
defines exactly what algorithm should be used for each operation, and how the execution of the operations should be coordinated.
evaluation plan
27
explores the space of all query-evaluation plans that are equivalent to the given query, and chooses the one with the least estimated cost.
cost-based optimizer
28
The most common type of query in SQL consists of a join of a few relations, with join predicates and selections specified in the where clause.
Cost-Based Join-Order Selection
29
the number of different query plans that are equivalent to the query can be large.
complex join query
30
store results of computations and reuse them, a procedure that can reduce execution time greatly.
Dynamic-programming algorithms
31
if it could be useful for a later operation.
interesting sort order
32
allows a logical operation, such as a join, to be transformed to a physical operation, such as a hash join, or a nested-loops join.
physical equivalence rules
33
stores the optimal query evaluation plan for a subexpression when it is optimized for the first time
memoization
34
reduce the cost of optimization
heuristics
35
are particularly convenient for pipelined evaluation, since the right operand is a stored relation, and thus only one input to each join is pipelined.
left-deep join orders
36
is a hierarchical procedure based on the nested-block concept of SQL.
Starburst project
37
Caching and reuse of query plans
Plan caching
38
as functions that take parameters and return either a single value or a set of values (possibly an empty set).
Optimizing Nested Subqueries
39
The parameters are the variables from an outer-level query that are used in the nested subquery
correlation variables
40
The technique of evaluating a nested subquery by invoking it as a function
correlated evaluation
41
The process of replacing a nested query by a query with a join, semijoin, or anti-semijoin
decorrelation
42
is a view whose contents are computed and stored.
materialized view
43
constitute redundant data, in that their contents can be inferred from the view definition and the rest of the database contents.
Materialized views
44
The task of keeping a materialized view up-to-date with the underlying data
view maintenance.
45
A better option is to modify only the affected parts of the materialized view
incremental view maintenance
46
Most database systems perform
immediate view maintenance
47
The changes (inserts and deletes) to a relation or expression
differential
48
which is a sequence of queries and updates that reflects the typical load on the system.
workload
49
The problem of an update affecting the execution of a query associated with the update
Halloween problem
50
Complex queries may in fact have subexpressions repeated in different parts of the query, which can be similarly exploited to reduce query evaluation cost.
multiquery optimization.
51
optimizes subexpressions shared by different expressions in a program by computing and storing the result and reusing it wherever the subexpression occurs.
Common subexpression elimination