04-05 - Query Execution & Processing

Status: #idea
Tags: CMU Advanced Database Systems

04-05 - Query Execution & Processing

Optimization Goals

  1. Reduce instruction count
  2. Reduce cycles per instruction
    • Reduce cache misses
    • Maximize data locality
  3. Parallelized execution

Query Execution

CPU Overview

Selection Scans

Scalar (Branching)

i = 0
for t in table:
	key = t.key
	if (low < key) && (key < high):
		copy(t, output[i])
		i = i + 1

Scalar (Branch-less)

i = 0
for t in table:
	copy(t, output[i]) # Always copying the data
	key = t.key
	delta = (low<key ? 1 : 0) & (key<high ? 1 : 0)
	i = i + delta
# NOTE: Ignore last element if delta is 0

Excessive instructions

DBMS must check a value's type before it performs any operation

Processing Model

Plan Processing Direction

Top-to-bottom (Pull)

Bottom-to-Top (Push)

Observation: Vector may contain some tuples which do not satisfy filters

Selection vector

Bitmap

Parallel Execution

Operator Output

Early materialization

Late materialization

Internal Data Representation

Expression Evaluation

Optimizations in Velox

Adaptive Query Processing


References

  1. 05 - Slides