14. 14
Appendix : Greenplum Tuning? ?? ?? ??
1
??? Skew
??
?? ???? ??? ??? ?? ? ? ??? ???? ?????
Seg1 Seg2 Seg3 Seg4
CREATE TABLE customer (
cust_id VARCHAR(80)
,gender CHAR(5))
DISTRIBUTED BY(gender);
Data Data
Seg1 Seg2 Seg3 Seg4
CREATE TABLE customer (
cust_id VARCHAR(80)
,gender CHAR(5))
DISTRIBUTED BY(cust_id);
Data Data Data Data
15. 15
Appendix : Greenplum Tuning? ?? ?? ??
2
?????
???
??? I/O?? ???? ? ?? ???? ???? ????
Seg1 Seg2 Seg3 Seg4
CREATE TABLE orders (
order_id INT
,order_date DATE )
DISTRIBUTED BY (order_id) ;
Data Data
Seg1 Seg2 Seg3 Seg4
:
DISTRIBUTED BY (order_id)
PARTITION BY RANGE (order_date)
(START (¡®2018-01-01¡¯)
END (¡®2018-12-031¡¯)
EVERY (INTERVAL ¡®1 month¡¯));
06 06 06 06
Data Data
SELECT COUNT(*) FROM orders WHERE order_date BETWEEN ¡®2018-10-22¡¯ and ¡®2018-10-27¡¯
07 07 07 07
08 08 08 08
09 09 09 09
10 10
10 10
16. 16
Appendix : Greenplum Tuning? ?? ?? ??
3
????
I/O ??
??? I/O?? ???? ? ?? ???? ???? ????
Seg1 Seg2 Seg3 Seg4
CREATE TABLE orders (
order_id INT
,order_date DATE )
DISTRIBUTED BY (order_id)
PARTITION BY RANGE (order_date)
:
Seg1 Seg2 Seg3 Seg4
CREATE TABLE orders WITH (
appendonly=true, compresslevel=5)(
order_id INT
,order_date DATE )
:
06 06 06 06
07 07 07 07
08 08 08 08
09 09 09 09
10 10
10 10
17. 17
Appendix : Greenplum Tuning? ?? ?? ??
4
???
?????
?? ???? ??? ???? ?? ??? ????? ???? ????
Seg1 Seg2 Seg3 Seg4
CREATE TABLE orders (
order_id INT
,order_date DATE
,product_id INT )
DISTRIBUTED BY (order_id);
Seg1 Seg2 Seg3 Seg4
CREATE INDEX idx_order_pid
ON orders (product_id);
Data Data Data Data Data Data Data Data