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.
6. 6Copyright ? 2015 NTT DATA Corporation
`
DAY Track1 Track2 Track3 Track4 Other
6/16
(Tue)
PM
AM
17
(Wed)
PM
AM
18
(Thu)
PM
AM
19
(Fri)
PM
AM
20
(Sat)
PM
AM
Unconference
Talks
Tutorial
Developer Meeting
Major Social Event!
Registration Pickup
Tutorial
TalksTutorialUnconference3
19. 19Copyright ? 2015 NTT DATA Corporation
Developer UnconferencehՓ줿
ܸ
1 A B C D 1 a B C D
1 A B C D a
CREATE TABLE test (id INT, col1 TEXT, col2 TEXT, col3 TEXT, col4 TEXT);
INSERT INTO test VALUES (1, 'A', 'B', 'C', 'D');
UPDATE test SET col1 = 'a' WHERE id = 1;
F״
ư
(ǤʤФ⺬)٤ƤФӛ
²֤Τߤӛ
28. 28Copyright ? 2015 NTT DATA Corporation
JSONB
Event Title
Tutorial NoSQL on ACID
Talk
Update and Delete operations for jsonb
Rethinking JSONB
Unconference Direction of json and jsonb
52. 52Copyright ? 2015 NTT DATA Corporation
UPSERT
INSERT INTO emp VALUES (3, 'ľ', '_k')
ON CONFLICT (id)
DO UPDATE
SET name = EXCLUDE.name,
role = EXCLUDE.role;
ФʤINSERTUPDATEg
id name role
1 _k
2 ӘI
3 ľ _k
4 ɽ U
5 ӘI
id=3Фʤ
INSERT INTO emp VALUES (3, 'ľ', '_k');
id=3Ф
UPDATE emp SET name = 'ľ', role = '_k'
WHERE id = 3;
53. 53Copyright ? 2015 NTT DATA Corporation
ROW LEVEL SECURITY
id name age role
1 27 _k
2 53 ӘI
3 ľ 45 _k
4 ɽ 39 U
5 31 ӘI
`foo
empƩ`֥
) _kߤΤߤ`fooESɤ
CREATE POLICY emp_foo_policy ON emp
FOR SELECT
TO foo
USING (role = '_k');
`E?ǤФָǤC
54. 54Copyright ? 2015 NTT DATA Corporation
pg_rewind
եХårDBǩ`֥ХååܞͤǤC
ץꥱ`
ޥ
Х
ֹͣ ޥ
ޥ
Х
ץꥱ`
ֹͣ ޥ
Хå
å
IϵڃP
ޥgڃP
IϵڃP
֥Хååܞ
ޥϤˤ
ե륪`
ɥޥٽMz
(եХå)
pg_rewind
եХårg̿s