ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
5
Most read
8
Most read
12
Most read
PostgreSQL
DB Tuning ????
PGDay.Seoul 2017
???(cjsong@naver.com)
??? cjsong@naver.com
? ChemEssen,Inc ?????
? ????? ?????????? ????????
? ¡®16 PostgreSQL DB ??
? ¡®99 web program ??
? ¡®97 Oracle Process Monitoring tool ?? by PB
? ¡®96 OCP-DBA 7.3 ??
? ¡®93 UNIX & C System program ??
About ChemEssen, Inc
? 2006 ??, 40? ????, ??? ????
? ????? ????? ?? ??? ??
? Chemical Quantum Application + Mathematical Modeling + IT
?? ?? ?? ?? ??
? ?? ?? ?? ??
? Master data 285?? ? 1?6???, 37? ??
? Master data size 25 GB ? 1 TB, 40? ??
? ???? ?? ??
? 651 msec ? 10? 17?, 948 ? ?? (ID)
? 1.2 ? ? 7? 20?, 367 ? ?? (name)
? 773 msec ? 10?, 776 ? ?? (smiles)
? Chemical data ???
? IUPAC Name
? (3R,6R,7R)-2,3,7-trimethyl-6-(propan-2-yl)tetradecane
? N'-[(2E)-3-(3,4-dimethoxyphenyl)prop-2-enoyl]-2-phenylacetohydrazide
? Smiles
? CC(C)CCCC(C)C3CCC4C2CC=C1CC(O)CCC1(C)C2CCC34C
? Formula
? C27H46O
? C11H14O3S2
?? ?? ??
?? Column type 285??
1?6???
???
1?6???
???
ID VC(12) 651 msec 10? 17? 32 msec
Name VC(4890) 1.2 sec 6? 16? 7 sec
Smiles Text 773 msec 10? 25? 547 msec
Formula VC(50) 1.2 sec 10? 33? 32 msec
InChIKey VC(50) 930 msec 10? 22? 46 msec
??????
? ?????? ???? SQL query ??
? ???? ?? ?? ?? ?? ??
? Index ???
? Text Search ?? ??
? DBMS Parameter ??
Text Search ?? ?? ??
? ?? ?? tsvector ?? ??
ALTER TABLE chemicalsc.tb_chem_info
ADD COLUMN textsearchable_index_col tsvector;
? Data update
UPDATE chemicalsc.tb_chem_info SET textsearchable_index_col
= to_tsvector('english', coalesce(replace(upper(iupac_name), ' ', ''), ''));
? Gin ??? ??
CREATE INDEX idx_chem_info_textsearchable_index_col
ON chemicalsc.tb_chem_info USING gin (textsearchable_index_col)
TABLESPACE tbs_chemical_idx00;
Sql query - ?? ?
SELECT chem_info_id, iupac_name,
(length('Benzene') - length(iupac_name) + 100) as jaro
FROM chemicalsc.tb_chem_info
WHERE iupac_name_upper_stuck like replace(upper( '%Benzene%' ), ' ', '' )
ORDER BY jaro desc, iupac_name asc
LIMIT 2000;
Sql query - ?? ?
SET work_mem to '100MB';
SELECT chem_info_id, iupac_name,
(length('benzen¡¯) - length(iupac_name)+100) as jaro
FROM chemicalsc.tb_chem_info
WHERE textsearchable_index_col @@ to_tsquery('english', 'benzen')
ORDER BY jaro desc, iupac_name asc
LIMIT 2000;
DB Server Spec
? Version: PostgreSQL 9.5.8 on x86_64-pc-linux-gnu
? CPU : XeonE5-2643 3.3GHz*8
? RAM : 32 GB
? Disk : 24 TB (1+0)
? Max Connection : 100
postgresql.conf
? effective_cache_size
? ??? ??? ??? ? ?? ??? ?
? ??? ???? ??
? shaed_buffers?????+?????OS?? ???
? ??? ????? *(50% ~ 75%)
? 32GB * 50% = 16GB, 32GB * 75% = 24GB
? maintenance_work_mem
? Vacuum, create index ??? ??
? 1GB?50MB
? 32 * 50MB = 1,600 MB
? shared_buffers
? Disk IO??? ??
? ??? ?? ??? *25%
? 32 GB * 0.25 = 8 GB
postgresql.conf
? work_mem
? sort, bitmap??,hash join, merge join??
? ????=total RAM /max_connections/ 4
? ????=total RAM /max_connections/ 16
? ???? ??? ?? ??
? 32 GB / 100 / 4 = 0.08 GB = 80 MB
? 32 GB / 100 / 16 = 0.02 GB = 20 MB
? wal_buffers
? DB????? ?? ???? ??
? 16MB
? max_wal_size / min_wal_size
? 2GB / 1GB
? stats_temp_directory
? /run/shm
Data update???¡­
? ??? ??? data insert / update ?? ??
? ??? ??? ????
data file 301? update ???? 42? ??
? Vaccum ?? check ?? ¨C 1?? ??
? data file 301? auto vaccum ?? 10? ??
? ??? insert ? COPY command ??
? set command ?? copy command
? Source data ?? ?? ? ???? COPY ??
? ?? ??? ??? ???
Q & A
?????
Ad

Recommended

[Pgday.Seoul 2020] SQL Tuning
[Pgday.Seoul 2020] SQL Tuning
PgDay.Seoul
?
[pgday.Seoul 2022] PostgreSQL?? - ???
[pgday.Seoul 2022] PostgreSQL?? - ???
PgDay.Seoul
?
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
PgDay.Seoul
?
PostgreSQL ???? ???? ???
PostgreSQL ???? ???? ???
PgDay.Seoul
?
[Pgday.Seoul 2021] 1. ??? ???? ????????? ??? SQL
[Pgday.Seoul 2021] 1. ??? ???? ????????? ??? SQL
PgDay.Seoul
?
[pgday.Seoul 2022] ?????? PostgreSQL ??? - ??? & ???
[pgday.Seoul 2022] ?????? PostgreSQL ??? - ??? & ???
PgDay.Seoul
?
[Pgday.Seoul 2019] Citus? ??? ?? ??????
[Pgday.Seoul 2019] Citus? ??? ?? ??????
PgDay.Seoul
?
[Pgday.Seoul 2017] 2. PostgreSQL? ?? ??? ?? ??? - ???
[Pgday.Seoul 2017] 2. PostgreSQL? ?? ??? ?? ??? - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 8. PostgreSQL 10 ??? ?? - ???
[Pgday.Seoul 2017] 8. PostgreSQL 10 ??? ?? - ???
PgDay.Seoul
?
Mvcc in postgreSQL ???
Mvcc in postgreSQL ???
PgDay.Seoul
?
[???????]Day #1 MySQL ????, ??, ?? ? ??, ???????
[???????]Day #1 MySQL ????, ??, ?? ? ??, ???????
Ji-Woong Choi
?
Pgday bdr ???
Pgday bdr ???
PgDay.Seoul
?
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
PGConf APAC
?
[pgday.Seoul 2022] POSTGRES ?????? ???? - ???
[pgday.Seoul 2022] POSTGRES ?????? ???? - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 6. GIN vs GiST ??? ??? - ???
[Pgday.Seoul 2017] 6. GIN vs GiST ??? ??? - ???
PgDay.Seoul
?
[Pgday.Seoul 2018] ??? DB?? PostgreSQL?? Migration? ?? DB2PG
[Pgday.Seoul 2018] ??? DB?? PostgreSQL?? Migration? ?? DB2PG
PgDay.Seoul
?
[2018] MySQL ??? ???
[2018] MySQL ??? ???
NHN FORWARD
?
Where¾Ñ¤¤¤Î¥­©`¡¢order by¾Ñ¤¤¤Î¥­©`
Where¾Ñ¤¤¤Î¥­©`¡¢order by¾Ñ¤¤¤Î¥­©`
yoku0825
?
MySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docx
NeoClova
?
MySQL Administrator 2021 - ?????
MySQL Administrator 2021 - ?????
NeoClova
?
[Cloud OnAir] Google Cloud ¤Ø¤Î¥Ç©`¥¿ÒÆÐÐ 2019Äê1ÔÂ24ÈÕ ·ÅËÍ
[Cloud OnAir] Google Cloud ¤Ø¤Î¥Ç©`¥¿ÒÆÐÐ 2019Äê1ÔÂ24ÈÕ ·ÅËÍ
Google Cloud Platform - Japan
?
Get to know PostgreSQL!
Get to know PostgreSQL!
Oddbj?rn Steffensen
?
MariaDB 10.5 binary install (???? ??)
MariaDB 10.5 binary install (???? ??)
NeoClova
?
Postgresql database administration volume 1
Postgresql database administration volume 1
Federico Campoli
?
MySQL_MariaDB??_??_????-202212.pptx
MySQL_MariaDB??_??_????-202212.pptx
NeoClova
?
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
?
Oracle database performance tuning
Oracle database performance tuning
Abishek V S
?
Advanced MySQL Query Tuning
Advanced MySQL Query Tuning
Alexander Rubin
?
? 10? ?? ?? ??? ?? ??????
? 10? ?? ?? ??? ?? ??????
EXEM
?
AWS 6? ??? | AWS?? MS SQL ?? ???? (??? ????????)
AWS 6? ??? | AWS?? MS SQL ?? ???? (??? ????????)
Amazon Web Services Korea
?

More Related Content

What's hot (20)

[Pgday.Seoul 2017] 8. PostgreSQL 10 ??? ?? - ???
[Pgday.Seoul 2017] 8. PostgreSQL 10 ??? ?? - ???
PgDay.Seoul
?
Mvcc in postgreSQL ???
Mvcc in postgreSQL ???
PgDay.Seoul
?
[???????]Day #1 MySQL ????, ??, ?? ? ??, ???????
[???????]Day #1 MySQL ????, ??, ?? ? ??, ???????
Ji-Woong Choi
?
Pgday bdr ???
Pgday bdr ???
PgDay.Seoul
?
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
PGConf APAC
?
[pgday.Seoul 2022] POSTGRES ?????? ???? - ???
[pgday.Seoul 2022] POSTGRES ?????? ???? - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 6. GIN vs GiST ??? ??? - ???
[Pgday.Seoul 2017] 6. GIN vs GiST ??? ??? - ???
PgDay.Seoul
?
[Pgday.Seoul 2018] ??? DB?? PostgreSQL?? Migration? ?? DB2PG
[Pgday.Seoul 2018] ??? DB?? PostgreSQL?? Migration? ?? DB2PG
PgDay.Seoul
?
[2018] MySQL ??? ???
[2018] MySQL ??? ???
NHN FORWARD
?
Where¾Ñ¤¤¤Î¥­©`¡¢order by¾Ñ¤¤¤Î¥­©`
Where¾Ñ¤¤¤Î¥­©`¡¢order by¾Ñ¤¤¤Î¥­©`
yoku0825
?
MySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docx
NeoClova
?
MySQL Administrator 2021 - ?????
MySQL Administrator 2021 - ?????
NeoClova
?
[Cloud OnAir] Google Cloud ¤Ø¤Î¥Ç©`¥¿ÒÆÐÐ 2019Äê1ÔÂ24ÈÕ ·ÅËÍ
[Cloud OnAir] Google Cloud ¤Ø¤Î¥Ç©`¥¿ÒÆÐÐ 2019Äê1ÔÂ24ÈÕ ·ÅËÍ
Google Cloud Platform - Japan
?
Get to know PostgreSQL!
Get to know PostgreSQL!
Oddbj?rn Steffensen
?
MariaDB 10.5 binary install (???? ??)
MariaDB 10.5 binary install (???? ??)
NeoClova
?
Postgresql database administration volume 1
Postgresql database administration volume 1
Federico Campoli
?
MySQL_MariaDB??_??_????-202212.pptx
MySQL_MariaDB??_??_????-202212.pptx
NeoClova
?
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
?
Oracle database performance tuning
Oracle database performance tuning
Abishek V S
?
Advanced MySQL Query Tuning
Advanced MySQL Query Tuning
Alexander Rubin
?
[Pgday.Seoul 2017] 8. PostgreSQL 10 ??? ?? - ???
[Pgday.Seoul 2017] 8. PostgreSQL 10 ??? ?? - ???
PgDay.Seoul
?
Mvcc in postgreSQL ???
Mvcc in postgreSQL ???
PgDay.Seoul
?
[???????]Day #1 MySQL ????, ??, ?? ? ??, ???????
[???????]Day #1 MySQL ????, ??, ?? ? ??, ???????
Ji-Woong Choi
?
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
PGConf APAC
?
[pgday.Seoul 2022] POSTGRES ?????? ???? - ???
[pgday.Seoul 2022] POSTGRES ?????? ???? - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 6. GIN vs GiST ??? ??? - ???
[Pgday.Seoul 2017] 6. GIN vs GiST ??? ??? - ???
PgDay.Seoul
?
[Pgday.Seoul 2018] ??? DB?? PostgreSQL?? Migration? ?? DB2PG
[Pgday.Seoul 2018] ??? DB?? PostgreSQL?? Migration? ?? DB2PG
PgDay.Seoul
?
[2018] MySQL ??? ???
[2018] MySQL ??? ???
NHN FORWARD
?
Where¾Ñ¤¤¤Î¥­©`¡¢order by¾Ñ¤¤¤Î¥­©`
Where¾Ñ¤¤¤Î¥­©`¡¢order by¾Ñ¤¤¤Î¥­©`
yoku0825
?
MySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docx
NeoClova
?
MySQL Administrator 2021 - ?????
MySQL Administrator 2021 - ?????
NeoClova
?
[Cloud OnAir] Google Cloud ¤Ø¤Î¥Ç©`¥¿ÒÆÐÐ 2019Äê1ÔÂ24ÈÕ ·ÅËÍ
[Cloud OnAir] Google Cloud ¤Ø¤Î¥Ç©`¥¿ÒÆÐÐ 2019Äê1ÔÂ24ÈÕ ·ÅËÍ
Google Cloud Platform - Japan
?
MariaDB 10.5 binary install (???? ??)
MariaDB 10.5 binary install (???? ??)
NeoClova
?
Postgresql database administration volume 1
Postgresql database administration volume 1
Federico Campoli
?
MySQL_MariaDB??_??_????-202212.pptx
MySQL_MariaDB??_??_????-202212.pptx
NeoClova
?
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
?
Oracle database performance tuning
Oracle database performance tuning
Abishek V S
?
Advanced MySQL Query Tuning
Advanced MySQL Query Tuning
Alexander Rubin
?

Similar to [Pgday.Seoul 2017] 7. PostgreSQL DB Tuning ???? - ??? (20)

? 10? ?? ?? ??? ?? ??????
? 10? ?? ?? ??? ?? ??????
EXEM
?
AWS 6? ??? | AWS?? MS SQL ?? ???? (??? ????????)
AWS 6? ??? | AWS?? MS SQL ?? ???? (??? ????????)
Amazon Web Services Korea
?
Amazon Redshift? ??? ?? (???) - AWS DB Day
Amazon Redshift? ??? ?? (???) - AWS DB Day
Amazon Web Services Korea
?
[Foss4 g2013 korea]postgis? geoserver? ??? ??? ????? ?? ??? ??? ?? ??
[Foss4 g2013 korea]postgis? geoserver? ??? ??? ????? ?? ??? ??? ?? ??
BJ Jang
?
?????? ????
?????? ????
Jinuk Bhak
?
? 5? ?? ?? ??? ?? ??????
? 5? ?? ?? ??? ?? ??????
EXEM
?
?????? 1??? 2??? ??????? ????? ????? ????.pptx
?????? 1??? 2??? ??????? ????? ????? ????.pptx
YeongKiKim1
?
Big query at GDG Korea Cloud meetup
Big query at GDG Korea Cloud meetup
Jude Kim
?
SQream DB, GPU-accelerated data warehouse
SQream DB, GPU-accelerated data warehouse
NAVER Engineering
?
??! AWS ?? ?????? ??????::???::AWS Summit Seoul 2018
??! AWS ?? ?????? ??????::???::AWS Summit Seoul 2018
Amazon Web Services Korea
?
[2015 07-06-???] Oracle ?? ??? ? ?? ??? 4
[2015 07-06-???] Oracle ?? ??? ? ?? ??? 4
Seok-joon Yun
?
AWS Partner ConneXions Online ¨C New Year Edition - AWS re:Invent 2020 Tech Re...
AWS Partner ConneXions Online ¨C New Year Edition - AWS re:Invent 2020 Tech Re...
Amazon Web Services Korea
?
Amazon Aurora ?? ?? ? ?????? ?? ?? - AWS Summit Seoul 2017
Amazon Aurora ?? ?? ? ?????? ?? ?? - AWS Summit Seoul 2017
Amazon Web Services Korea
?
Graviton2 ??? EC2 ???? ?? ?? - ??? :: AWS Unboxing ??? ???
Graviton2 ??? EC2 ???? ?? ?? - ??? :: AWS Unboxing ??? ???
Amazon Web Services Korea
?
Alluxio: Data Orchestration on Multi-Cloud
Alluxio: Data Orchestration on Multi-Cloud
Jinwook Chung
?
Amazon aurora 2
Amazon aurora 2
EXEM
?
Ndc2011 ?? ???_??_??????_????_??_?_??_???
Ndc2011 ?? ???_??_??????_????_??_?_??_???
cranbe95
?
?????? 1??? 2??? ??????? ????? ????? ????.pptx
?????? 1??? 2??? ??????? ????? ????? ????.pptx
yeongkikim2
?
DEVIEW 2013 Presentation
DEVIEW 2013 Presentation
Won Gil Kim
?
Amazon Aurora ?? ??? ????::???::AWS Summit Seoul 2018
Amazon Aurora ?? ??? ????::???::AWS Summit Seoul 2018
Amazon Web Services Korea
?
? 10? ?? ?? ??? ?? ??????
? 10? ?? ?? ??? ?? ??????
EXEM
?
AWS 6? ??? | AWS?? MS SQL ?? ???? (??? ????????)
AWS 6? ??? | AWS?? MS SQL ?? ???? (??? ????????)
Amazon Web Services Korea
?
[Foss4 g2013 korea]postgis? geoserver? ??? ??? ????? ?? ??? ??? ?? ??
[Foss4 g2013 korea]postgis? geoserver? ??? ??? ????? ?? ??? ??? ?? ??
BJ Jang
?
? 5? ?? ?? ??? ?? ??????
? 5? ?? ?? ??? ?? ??????
EXEM
?
?????? 1??? 2??? ??????? ????? ????? ????.pptx
?????? 1??? 2??? ??????? ????? ????? ????.pptx
YeongKiKim1
?
Big query at GDG Korea Cloud meetup
Big query at GDG Korea Cloud meetup
Jude Kim
?
SQream DB, GPU-accelerated data warehouse
SQream DB, GPU-accelerated data warehouse
NAVER Engineering
?
??! AWS ?? ?????? ??????::???::AWS Summit Seoul 2018
??! AWS ?? ?????? ??????::???::AWS Summit Seoul 2018
Amazon Web Services Korea
?
[2015 07-06-???] Oracle ?? ??? ? ?? ??? 4
[2015 07-06-???] Oracle ?? ??? ? ?? ??? 4
Seok-joon Yun
?
AWS Partner ConneXions Online ¨C New Year Edition - AWS re:Invent 2020 Tech Re...
AWS Partner ConneXions Online ¨C New Year Edition - AWS re:Invent 2020 Tech Re...
Amazon Web Services Korea
?
Amazon Aurora ?? ?? ? ?????? ?? ?? - AWS Summit Seoul 2017
Amazon Aurora ?? ?? ? ?????? ?? ?? - AWS Summit Seoul 2017
Amazon Web Services Korea
?
Graviton2 ??? EC2 ???? ?? ?? - ??? :: AWS Unboxing ??? ???
Graviton2 ??? EC2 ???? ?? ?? - ??? :: AWS Unboxing ??? ???
Amazon Web Services Korea
?
Alluxio: Data Orchestration on Multi-Cloud
Alluxio: Data Orchestration on Multi-Cloud
Jinwook Chung
?
Amazon aurora 2
Amazon aurora 2
EXEM
?
Ndc2011 ?? ???_??_??????_????_??_?_??_???
Ndc2011 ?? ???_??_??????_????_??_?_??_???
cranbe95
?
?????? 1??? 2??? ??????? ????? ????? ????.pptx
?????? 1??? 2??? ??????? ????? ????? ????.pptx
yeongkikim2
?
DEVIEW 2013 Presentation
DEVIEW 2013 Presentation
Won Gil Kim
?
Amazon Aurora ?? ??? ????::???::AWS Summit Seoul 2018
Amazon Aurora ?? ??? ????::???::AWS Summit Seoul 2018
Amazon Web Services Korea
?
Ad

More from PgDay.Seoul (17)

[pgday.Seoul 2022] PostgreSQL with Google Cloud
[pgday.Seoul 2022] PostgreSQL with Google Cloud
PgDay.Seoul
?
[Pgday.Seoul 2020] ???????? ???? ???
[Pgday.Seoul 2020] ???????? ???? ???
PgDay.Seoul
?
[Pgday.Seoul 2019] AppOS ??? I/O ?? ??? ?? 10? ?????
[Pgday.Seoul 2019] AppOS ??? I/O ?? ??? ?? 10? ?????
PgDay.Seoul
?
[Pgday.Seoul 2019] Advanced FDW
[Pgday.Seoul 2019] Advanced FDW
PgDay.Seoul
?
[Pgday.Seoul 2018] PostgreSQL 11 ? ?? ??
[Pgday.Seoul 2018] PostgreSQL 11 ? ?? ??
PgDay.Seoul
?
[Pgday.Seoul 2018] PostgreSQL ??? ?? ??? ????? OS ?? apposha
[Pgday.Seoul 2018] PostgreSQL ??? ?? ??? ????? OS ?? apposha
PgDay.Seoul
?
[Pgday.Seoul 2018] PostgreSQL Authentication with FreeIPA
[Pgday.Seoul 2018] PostgreSQL Authentication with FreeIPA
PgDay.Seoul
?
[Pgday.Seoul 2018] AWS Cloud ???? PostgreSQL ????
[Pgday.Seoul 2018] AWS Cloud ???? PostgreSQL ????
PgDay.Seoul
?
[Pgday.Seoul 2018] Greenplum? ?? ?? ??
[Pgday.Seoul 2018] Greenplum? ?? ?? ??
PgDay.Seoul
?
[Pgday.Seoul 2018] replacing oracle with edb postgres
[Pgday.Seoul 2018] replacing oracle with edb postgres
PgDay.Seoul
?
[Pgday.Seoul 2017] 5. ?????(???) PostgreSQL ???? - ???
[Pgday.Seoul 2017] 5. ?????(???) PostgreSQL ???? - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 1. PostGIS? ??? ? PostgreSQL ?? - ???
[Pgday.Seoul 2017] 1. PostGIS? ??? ? PostgreSQL ?? - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 4. Composite Type/JSON ????? ??? TVP??(with C#, JAVA) - ???
[Pgday.Seoul 2017] 4. Composite Type/JSON ????? ??? TVP??(with C#, JAVA) - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - ???
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - ???
PgDay.Seoul
?
PostgreSQL 9.6 ? ?? ??
PostgreSQL 9.6 ? ?? ??
PgDay.Seoul
?
pg_hba.conf ???
pg_hba.conf ???
PgDay.Seoul
?
Pg report 20161010_02
Pg report 20161010_02
PgDay.Seoul
?
[pgday.Seoul 2022] PostgreSQL with Google Cloud
[pgday.Seoul 2022] PostgreSQL with Google Cloud
PgDay.Seoul
?
[Pgday.Seoul 2020] ???????? ???? ???
[Pgday.Seoul 2020] ???????? ???? ???
PgDay.Seoul
?
[Pgday.Seoul 2019] AppOS ??? I/O ?? ??? ?? 10? ?????
[Pgday.Seoul 2019] AppOS ??? I/O ?? ??? ?? 10? ?????
PgDay.Seoul
?
[Pgday.Seoul 2019] Advanced FDW
[Pgday.Seoul 2019] Advanced FDW
PgDay.Seoul
?
[Pgday.Seoul 2018] PostgreSQL 11 ? ?? ??
[Pgday.Seoul 2018] PostgreSQL 11 ? ?? ??
PgDay.Seoul
?
[Pgday.Seoul 2018] PostgreSQL ??? ?? ??? ????? OS ?? apposha
[Pgday.Seoul 2018] PostgreSQL ??? ?? ??? ????? OS ?? apposha
PgDay.Seoul
?
[Pgday.Seoul 2018] PostgreSQL Authentication with FreeIPA
[Pgday.Seoul 2018] PostgreSQL Authentication with FreeIPA
PgDay.Seoul
?
[Pgday.Seoul 2018] AWS Cloud ???? PostgreSQL ????
[Pgday.Seoul 2018] AWS Cloud ???? PostgreSQL ????
PgDay.Seoul
?
[Pgday.Seoul 2018] Greenplum? ?? ?? ??
[Pgday.Seoul 2018] Greenplum? ?? ?? ??
PgDay.Seoul
?
[Pgday.Seoul 2018] replacing oracle with edb postgres
[Pgday.Seoul 2018] replacing oracle with edb postgres
PgDay.Seoul
?
[Pgday.Seoul 2017] 5. ?????(???) PostgreSQL ???? - ???
[Pgday.Seoul 2017] 5. ?????(???) PostgreSQL ???? - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 1. PostGIS? ??? ? PostgreSQL ?? - ???
[Pgday.Seoul 2017] 1. PostGIS? ??? ? PostgreSQL ?? - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 4. Composite Type/JSON ????? ??? TVP??(with C#, JAVA) - ???
[Pgday.Seoul 2017] 4. Composite Type/JSON ????? ??? TVP??(with C#, JAVA) - ???
PgDay.Seoul
?
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - ???
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - ???
PgDay.Seoul
?
PostgreSQL 9.6 ? ?? ??
PostgreSQL 9.6 ? ?? ??
PgDay.Seoul
?
Pg report 20161010_02
Pg report 20161010_02
PgDay.Seoul
?
Ad

[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning ???? - ???

  • 1. PostgreSQL DB Tuning ???? PGDay.Seoul 2017 ???(cjsong@naver.com)
  • 2. ??? cjsong@naver.com ? ChemEssen,Inc ????? ? ????? ?????????? ???????? ? ¡®16 PostgreSQL DB ?? ? ¡®99 web program ?? ? ¡®97 Oracle Process Monitoring tool ?? by PB ? ¡®96 OCP-DBA 7.3 ?? ? ¡®93 UNIX & C System program ??
  • 3. About ChemEssen, Inc ? 2006 ??, 40? ????, ??? ???? ? ????? ????? ?? ??? ?? ? Chemical Quantum Application + Mathematical Modeling + IT
  • 4. ?? ?? ?? ?? ?? ? ?? ?? ?? ?? ? Master data 285?? ? 1?6???, 37? ?? ? Master data size 25 GB ? 1 TB, 40? ?? ? ???? ?? ?? ? 651 msec ? 10? 17?, 948 ? ?? (ID) ? 1.2 ? ? 7? 20?, 367 ? ?? (name) ? 773 msec ? 10?, 776 ? ?? (smiles) ? Chemical data ??? ? IUPAC Name ? (3R,6R,7R)-2,3,7-trimethyl-6-(propan-2-yl)tetradecane ? N'-[(2E)-3-(3,4-dimethoxyphenyl)prop-2-enoyl]-2-phenylacetohydrazide ? Smiles ? CC(C)CCCC(C)C3CCC4C2CC=C1CC(O)CCC1(C)C2CCC34C ? Formula ? C27H46O ? C11H14O3S2
  • 5. ?? ?? ?? ?? Column type 285?? 1?6??? ??? 1?6??? ??? ID VC(12) 651 msec 10? 17? 32 msec Name VC(4890) 1.2 sec 6? 16? 7 sec Smiles Text 773 msec 10? 25? 547 msec Formula VC(50) 1.2 sec 10? 33? 32 msec InChIKey VC(50) 930 msec 10? 22? 46 msec
  • 6. ?????? ? ?????? ???? SQL query ?? ? ???? ?? ?? ?? ?? ?? ? Index ??? ? Text Search ?? ?? ? DBMS Parameter ??
  • 7. Text Search ?? ?? ?? ? ?? ?? tsvector ?? ?? ALTER TABLE chemicalsc.tb_chem_info ADD COLUMN textsearchable_index_col tsvector; ? Data update UPDATE chemicalsc.tb_chem_info SET textsearchable_index_col = to_tsvector('english', coalesce(replace(upper(iupac_name), ' ', ''), '')); ? Gin ??? ?? CREATE INDEX idx_chem_info_textsearchable_index_col ON chemicalsc.tb_chem_info USING gin (textsearchable_index_col) TABLESPACE tbs_chemical_idx00;
  • 8. Sql query - ?? ? SELECT chem_info_id, iupac_name, (length('Benzene') - length(iupac_name) + 100) as jaro FROM chemicalsc.tb_chem_info WHERE iupac_name_upper_stuck like replace(upper( '%Benzene%' ), ' ', '' ) ORDER BY jaro desc, iupac_name asc LIMIT 2000;
  • 9. Sql query - ?? ? SET work_mem to '100MB'; SELECT chem_info_id, iupac_name, (length('benzen¡¯) - length(iupac_name)+100) as jaro FROM chemicalsc.tb_chem_info WHERE textsearchable_index_col @@ to_tsquery('english', 'benzen') ORDER BY jaro desc, iupac_name asc LIMIT 2000;
  • 10. DB Server Spec ? Version: PostgreSQL 9.5.8 on x86_64-pc-linux-gnu ? CPU : XeonE5-2643 3.3GHz*8 ? RAM : 32 GB ? Disk : 24 TB (1+0) ? Max Connection : 100
  • 11. postgresql.conf ? effective_cache_size ? ??? ??? ??? ? ?? ??? ? ? ??? ???? ?? ? shaed_buffers?????+?????OS?? ??? ? ??? ????? *(50% ~ 75%) ? 32GB * 50% = 16GB, 32GB * 75% = 24GB ? maintenance_work_mem ? Vacuum, create index ??? ?? ? 1GB?50MB ? 32 * 50MB = 1,600 MB ? shared_buffers ? Disk IO??? ?? ? ??? ?? ??? *25% ? 32 GB * 0.25 = 8 GB
  • 12. postgresql.conf ? work_mem ? sort, bitmap??,hash join, merge join?? ? ????=total RAM /max_connections/ 4 ? ????=total RAM /max_connections/ 16 ? ???? ??? ?? ?? ? 32 GB / 100 / 4 = 0.08 GB = 80 MB ? 32 GB / 100 / 16 = 0.02 GB = 20 MB ? wal_buffers ? DB????? ?? ???? ?? ? 16MB ? max_wal_size / min_wal_size ? 2GB / 1GB ? stats_temp_directory ? /run/shm
  • 13. Data update???¡­ ? ??? ??? data insert / update ?? ?? ? ??? ??? ???? data file 301? update ???? 42? ?? ? Vaccum ?? check ?? ¨C 1?? ?? ? data file 301? auto vaccum ?? 10? ?? ? ??? insert ? COPY command ?? ? set command ?? copy command ? Source data ?? ?? ? ???? COPY ?? ? ?? ??? ??? ???