10. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 Copyright 2017 Insight Technology, Inc. All Rights Reserved.
DWH向けDBの基本のき – カラムナー
Prod ID Prod Name
Prod ID Prod Name
Prod ID Prod Name
Prod ID Prod Name
Prod ID Prod Name
Date
Date
Date
Date
Date
Prod ID Prod Name
Prod ID Prod Name
Prod ID Prod Name
Prod ID Prod Name
Prod ID Prod Name
Date
Date
Date
Date
Date
1ブロックには様々な
タイプのデータが格納
されているので圧縮効
率を上げにくい
1ブロックには同様の
タイプのデータが格納
されているので圧縮効
率を上げやすい
通常のDB(⾏指向) 分析⽤DB(列指向)
11. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 Copyright 2017 Insight Technology, Inc. All Rights Reserved.
でも、みんなやってるんだよね?
DWH⽤ベンチマークのTPC-HでmonetDBと⽐較してみよう
実⾏環境
• AWS EC2のi3.4xlargeを使⽤
16vCPU, 122GB Memory, NVMe SSD
• データベースのサイズ:1TB(Scale Factor=1000)
VS
monetDBとは
• オープンソースカラムナーDBのパイオニア
• 実はVectorはmonetDBを100倍速くするプロ
ジェクトとしてスタートした
13. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 Copyright 2017 Insight Technology, Inc. All Rights Reserved.
Vectorの肝は、CPUの使い⽅にあり
SIMD (Single Instruction Multiple Data)
Pentium ⅢよりSSE(Streaming SIMD Extensions)として搭載され、
Sandy BridgeよりIntel AVX(Advanced Vector eXtensions)へ
・・・
・・・
・・・
・・・
・・・
Instruction
Data
Output
14. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 Copyright 2017 Insight Technology, Inc. All Rights Reserved.
実⾏命令数の⽐較
27412968251
2.3858E+11
1.9685E+11
7.82182E+11
1.88149E+12 1.87184E+12
1
9 7
29
69
68
0
10
20
30
40
50
60
70
80
0.0E+00
1.0E+12
2.0E+12
Columnar DB
A
Columnar DB
B
In Memory DB
A
Rt = Instructions / (IPC * Hz * Parallelism)
Row Store DB
A
Row Store DB
B
CPUInstructions(count)
ComparisonvsVector
select
sum(l_extendedprice * l_discount) as revenue
from
lineitem -- 6億件, 80GB のデータ
where l_shipdate >= date '1996-01-01'
and l_shipdate < date '1996-01-01' + interval '1' year
and l_discount between 0.02 - 0.01 and 0.02 + 0.01
and l_quantity < 24
SIMD効果により、少ない命令数で済む
TPC-H Q6
15. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 Copyright 2017 Insight Technology, Inc. All Rights Reserved.
ブランチミス数の⽐較
1.8E+07
1.1E+09
3.0E+08
1.1E+09
1.6E+09
7.7E+08
1
64
17
62
88
43
0
10
20
30
40
50
60
70
80
90
100
0.0E+00
1.0E+09
2.0E+09
Columnar DB
A
Columnar DB
B
In Memory DB
A
Row Store DB
A
Row Store DB
B
Rt = Instructions / (IPC * Hz * Parallelism)
CPUBranch-Misses(count)
ComparisonvsVector
そもそも分岐命令数が1〜2桁少ない。よってブランチミスのペナルティも少なくて済む。
16. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 Copyright 2017 Insight Technology, Inc. All Rights Reserved.
その結果がクエリの⾼速実⾏に
0.48 3.44
35.58
209.45
467.36
332.56
1
7
74
434
968
689
0
200
400
600
800
1000
1200
0
50
100
150
200
250
300
350
400
450
500
Columnar DB
A
Columnar DB
B
In Memory DB
A
Row Store DB
A
Row Store DB
B
Rt = Instructions / (IPC * Hz * Parallelism)
QueryElapsedTime(sec)
ComparisonvsVector
実⾏時間の⽐較