Query Execution in Column-Stores Atte Hinkka Seminar on Columnar - - PowerPoint PPT Presentation

query execution in column stores
SMART_READER_LITE
LIVE PREVIEW

Query Execution in Column-Stores Atte Hinkka Seminar on Columnar - - PowerPoint PPT Presentation

Query Execution in Column-Stores Atte Hinkka Seminar on Columnar Databases, Fall 2012 1 Central concepts Column (query) operators Compression considerations Materialization strategies Vectorized operations 2 Query what?


slide-1
SLIDE 1

Query Execution in Column-Stores

Atte Hinkka

Seminar on Columnar Databases, Fall 2012

1

slide-2
SLIDE 2

Central concepts

  • Column (query) operators
  • Compression considerations
  • Materialization strategies
  • Vectorized operations

2

slide-3
SLIDE 3

Query what?

  • Query operator trees
  • Models for query execution
  • Architectural models
  • Roots in the transactional world

3

slide-4
SLIDE 4

Query operator tree

4

slide-5
SLIDE 5

Query operator tree

scan.next() => {“Virtanen”, “Veijo”, 2011-02-01, 3}

4

slide-6
SLIDE 6

Query operator tree

scan.next() => {“Virtanen”, “Veijo”, 2011-02-01, 3} scan.next() => {“Meikäläinen”, “Matti”, 2012-06-01, 3}

4

slide-7
SLIDE 7

Query operator tree

scan.next() => {“Virtanen”, “Veijo”, 2011-02-01, 3} select.next() => {“Meikäläinen”, “Matti”, 2012-06-01, 3} scan.next() => {“Meikäläinen”, “Matti”, 2012-06-01, 3}

4

slide-8
SLIDE 8

Volcano model

  • Each query operator provides an iterator

interface

  • Iterator returns tuples from the disk
  • Conceptually simple, beautiful
  • Optimizations focused on the query plan

level: avoid full table scans, minimize the amount of tuples processed

5

slide-9
SLIDE 9

Problems with Volcano

  • A query heavy of

aggregation operators (AVG, SUM, ...) may spend only 10% of time averaging and summing, i.e. doing actual work

  • MIPS R12000 can do a

double multiplication in 3 cycles, MySQL takes 49 to do that; no loop pipelining!

6

slide-10
SLIDE 10

Column-oriented processing

  • Predicates in Scan operators
  • Late tuple materialization
  • Invisible joins
  • Operations on compressed data

7

slide-11
SLIDE 11

Predicates on Scan

  • perators
  • Possible to do exact matches on heavily-

compressed data (LZ-encoding)

  • Can avoid dictionary lookups in a similar

fashion

  • Operating on run-length or bit-vector -

encoded columns is possible when the predicate matcher knows about the compression used

8

slide-12
SLIDE 12

Late tuple materialization

  • Operators operate on position lists
  • Join position lists and materialize tuples at

the very end

  • Position lists are trivial to produce from

sorted columns (<, >, ==)

  • Position lists can be coded as bitmaps for

CPU-efficiency

9

slide-13
SLIDE 13

Invisible join

  • Compute a bitmap (position list) for select

predicates

  • Join result is the intersection of bitmaps
  • Results can be calculated efficiently by bitmap
  • perations
  • Useful in column-stores and data warehouses

where joins of facts & dimensions

10

slide-14
SLIDE 14

Operating on compressed data

  • Push predicate down to Scan operator
  • Don’t decompress when not needed
  • Dictionary encoding only needs to decompress
  • nce
  • Keep a cache of decompressed values
  • Makes it possible to store columns in

multiple sort orders

11

slide-15
SLIDE 15

Performance benefits

  • f...
  • Late materialization
  • Compression
  • Invisible join

12

slide-16
SLIDE 16

13

slide-17
SLIDE 17

Alternative design

  • C-Store
  • Column-optimized

Query operators

  • Late tuple

materialization

  • Modified Scan
  • perators
  • MonetDB/X100
  • Query execution as

array manipulation

  • Emphasis on

vectorized processing and high CPU efficiency

14

slide-18
SLIDE 18

MonetDB/X100, solving memory bottleneck

  • Operators work with chunks of data that

fit in the CPU cache (~1024 values)

  • Operators are vectorized, have low degree
  • f freedom (are simple, don’t handle

arbitrary predicates etc) in order for the compiler to be able to do loop pipelining

  • Decompress pages to CPU cache, not RAM

15

slide-19
SLIDE 19

X100 query tree

  • Still a pull-model, but

based on vectors, not tuples or values

  • Emphasis on CPU cache

efficiency

  • Enables Single-

Instruction-Multiple- Data (SIMD) instructions

16

slide-20
SLIDE 20
  • Operator changes
  • Scan operator that knows of compression and

can handle predicates

  • Late tuple materialization
  • Invisible joins
  • Operations on compressed data
  • Vectorized processing

Recap

17