7. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 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(列指向)
8. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 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倍速くするプロ
ジェクトとしてスタートした
10. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 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
11. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 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
12. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 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桁少ない。よってブランチミスのペナルティも少なくて済む。
13. * 記載されている会社名、サービス名、製品名は、株式会社インサイトテクノロジーおよび各社の商標または登録商標です。 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
実行時間の比較