ほんとに使える?Big Data SQL検証結果から見る、その有益性(性能編)オラクルエンジニア通信
?
パートナー企業のNTTデータ先端技術株式会社様によるOracle Big Data SQL 検証の検証に関する資料です。
Oracle Exadata のDWH処理を Oracle Big Data Appliance にオフロードした構成で、DWH処理の性能やOLTP処理への影響などの観点で、検証頂いています。
より詳細なデータやノウハウについては、是非、NTTデータ先端技術株式会社様にお問い合わせください。
NTTデータ先端技術㈱オラクル事業部
oracle-sales@intellilink.co.jp
This document discusses the application of PostgreSQL in a large social infrastructure project involving smart meter management. It describes three main missions: (1) loading 10 million datasets within 10 minutes, (2) saving data for 24 months, and (3) stabilizing performance for large scale SELECT statements. Various optimizations are discussed to achieve these missions, including data modeling, performance tuning, reducing data size, and controlling execution plans. The results showed that all three missions were successfully completed by applying PostgreSQL expertise and customizing it for the large-scale requirements of the project.
27. ? 2017 NTT DATA Corporation 27
? 処理時間は、データ分布(物理的に連続しているか)と取得
件数の影響大
? PostgreSQLのプランナはseqscanを選んだ
(random_page_cost = 1にもかかわらず)
インデックス検証
49
5 5
0
10
20
30
40
50
60
Seq btree brin
実行時間(秒)
select * from table between xx < col1 AND col2 < yy;
※全体の30%程度を取得
28. ? 2017 NTT DATA Corporation 28
? pg_hint_planの「テーブルでの指定」を使う
? コメントを使った方法と異なり、クエリを書き換えられなくても、
「hint_plan.hints」テーブルに、実行計画を制御したいクエ
リとヒントを登録しておくと、ヒントが効く
対処法として1つのアイデア
=# explain analyze select * from test where id = 1;
QUERY PLAN
-------------------------------------------------------------------------
Index Only Scan using a on test (cost=0.29..8.30 rows=1 width=4) …
Index Cond: (id = 1)
Heap Fetches: 1
Planning time: 0.054 ms
Execution time: 0.027 ms
(5 行)
=# set pg_hint_plan.enable_hint_table to on;
SET
=# explain analyze select * from test where id = 1;
QUERY PLAN
------------------------------------------------------------------------
Seq Scan on test (cost=0.00..170.00 rows=1 width=4) …
Filter: (id = 1)
Rows Removed by Filter: 9999
Planning time: 0.031 ms
Execution time: 0.808 ms
(5 行)
34. ? 2017 NTT DATA Corporation 34
? 10.0では、Prepared Statementを使っていると、パラレル
されない場合がある。
? Custom plan …バインド変数を考慮した実行計画
? Generic plan …バインド変数を考慮しない実行計画
パラレルクエリが効かない!?(3)
C C C C C C
G
C C
G G10.0ではパラレルされない
(10.1で修正済み)
TableauのODBC接続パラメータでPreparedを使わないように設定。
Prepared Statement利用によるプランニング時間の短縮はできなくなる。
35. ? 2017 NTT DATA Corporation 35
? custom plan
補足:generic planであるかどうか?の確認
? generic plan
Finalize Aggregate
-> Gather
Workers Planned: 4
-> Partial Aggregate
-> Parallel Seq Scan on tenk1
Filter: (hundred > 1)
Aggregate
-> Seq Scan on tenk1
Filter: (hundred > $1)