4. Query Optimization Flashcards

1
Q

Equivalence Rules 1
Conjunctive selection operations can be deconstructed into a
___ of individual ___

A

Sequence

Selections

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

Equivalence Rules 2

Selection operations are ___

A

Commutative

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

Equivalence Rules 3

Only the last in a sequence of ___ is needed, the others can be ___.

A

Projection operations

Omitted

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

Equivalence Rules 4

Selections can be combined with ___ and ___.

A

Cartesian products

Theta joins

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

Equivalence Rules 5

Theta-join operations (and natural joins) are ___.

A

Commutative

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

Equivalence Rules 6
Natural join operations are ___. Theta joins too in a special manner
(E1 ⨝[theta 12] E2) ⨝[theta 13 ^ theta 23] E3
≡ E1 ⨝[theta 12 ^ theta 13] (E2 ⨝[theta 23] E3)

A

Associative

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

Equivalence Rules 7
The selection operation distributes over the theta join operation under the following two conditions

a) sigma_theta 1 (E1 ⨝_theta E2)
≡ (sigma_theta 1 (E1)) ⨝_theta E2

b) sigma_[theta 1 ^ theta 2] (E1 ⨝_theta E2)
≡ (sigma_theta 1 (E1)) ⨝_theta E2 (sigma_theta 2 (E2))

A

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

Equivalence Rules 8
produtorio_[L1 U L2] (E1 ⨝_theta E2)
≡ produtorio_L1 (E1) ⨝ produtorio_L2 (E2)

A

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

Equivalence Rules 9/10/11

The set of operations Union and Intersection are ___ and ___. Also they distribute over ___, ___ and ___

A

Commutative
Associative
U, Inverse U and -

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

Equivalence Rules 12

The Projection Operation distributes over ___

A

Union

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

Equi-depth histograms break up range such that each range has (approximately) ___

A

The same number of tuples

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

Size Estimation for Selection

a) If the selection of atribute A equal to value v in relation then size estimate is equal to ___
b) If A <=v then c=___ if v= max(A,r)
c) c is assumed to be ___ in the absence of statistical information

A

1
0
nr
nr/2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
Size Estimation for Join
a) if every tuple t in R procuces tuples in R ⨝ S
\_\_\_
b) If the reverse is true
\_\_\_
Choose the lowest of this estimates
A

nr * ns / V(A,s) [distinct values of A in s]

nr * ns / V(A,r)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
Size Estimation for Projection
produtorio A (r) = \_\_\_
A

V(A,r)

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

Cost-Based Optimization

Instead of generating all ___ find the best join order for every __ by finding the best order for ___ recursively

A

Join orders
Subset
Each subset of every subset

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

Heuristics-based optimization
Heuristic optimization transforms the ___ using the following rules:
1- Perform ___ and ___ early
2- Perform most restrictive ___ and ___ operations (with smallest result size) before other similar operations

A

Query-tree
Selection and Projection
Selection and Join

17
Q

Memoization
Store the best ___ for a ___ the first time it is optimized, and reuse it on repeated ___ calls on the same subexpression

A

Plan
Subexpression
Optimization

18
Q

Plan Caching

___ previously computed plan if query is ___

A

Reuse

Resubmitted

19
Q

A materialized view is a view whose contents are ___ and ___.

A

Computed

Stored

20
Q

Materialized view maintenance is the task of keeping the materialized view ___

a) recompute on every update
b) use incremental view maintenance (changes to relation updates view)

A

Up-to-tade

21
Q

Query Optimization with Materialized Views

a) View v = r ⨝ s / User submits r ⨝ s ⨝ t / Query equal to ___
b) View v = r ⨝ s / User sumbits select A=10 (v) / r has an index on A while s has an index on the common attribute / Best plan ___

A

a) v ⨝ t

b) select A=10(r) ⨝ s