Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×

[Pgday.Seoul 2017] 8. PostgreSQL 10 새기능 소개 - 김상기

Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Próximo SlideShare
Pgday bdr 천정대
Pgday bdr 천정대
Cargando en…3
×

Eche un vistazo a continuación

1 de 20 Anuncio

Más Contenido Relacionado

Presentaciones para usted (20)

Similares a [Pgday.Seoul 2017] 8. PostgreSQL 10 새기능 소개 - 김상기 (20)

Anuncio

Más de PgDay.Seoul (20)

Más reciente (20)

Anuncio

[Pgday.Seoul 2017] 8. PostgreSQL 10 새기능 소개 - 김상기

  1. 1. PgDay.Seoul 2017 2017-11-04 PostgreSQL 10 새기능 소개 김상기
  2. 2. 2017-11-04 2 PgDay.Seoul 2017 PostgreSQL 10 새기능 ● 김상기 – 현재 사내 PostgreSQL 마이스터로 활동 ● Facebook PostgreSQL Korea 그룹 구성원 – 매월 마지막 주 일요일 PostgreSQL 기술 세미나 운영 ● 주말 아이 돌볼 일도 , 애인 만날 일도 없는 이들의 모임 ● PostgreSQL.kr 홈페이지 운영자 – 여러 한국어 환경에서 쓰기 좋은 PostgreSQL 이 되도록 하는 작업 ● 문서 & 배포판 메시지 자국어화 작업 기여 ● textsearch_ko 전문 검색 확장 모듈 개발 ● 사내 각종 PostgreSQL 컨설팅 및 교육 담당 – 전환 , 신규 시스템 설계 컨설팅 및 개발 , 운영 지원 – 개발자 , 운영자를 위한 정기 사내 교육 – 컨소이엄 재직자 무료 교육 ● kr@postgresql.org
  3. 3. 2017-11-04 3 PgDay.Seoul 2017 PostgreSQL 10 새기능 ● 포스트그레스큐엘 소개 12 13 13 13 13 13 13 14 14 14 14 14 14 15 15 15 15 15 15 16 16 16 16 16 16 17 17 17 17 17 0 20 40 60 80 100 120 PostgreSQL MySQL Oracle SQL Server 구글 트랜드 차트 9.4 9.5 9.6 10 0 2 4 6 8 10 12 14 16 18 버전 별 새 기능 수
  4. 4. 2017-11-04 4 PgDay.Seoul 2017 PostgreSQL 10 새기능 차례 응용 프로그램 개발자 – 파티션 테이블 – 논리 복제 – AS IDENTITY 칼럼 속성 – pg_sequence – XMLTABLE – UPDATE 구문 확장 – to_date('2017-02-35','YYYY-MM-DD')
  5. 5. 2017-11-04 5 PgDay.Seoul 2017 PostgreSQL 10 새기능 파티션 테이블 CREATE TABLE measurement ( logdate date not null, peaktemp int, unitsales int ) PARTITION BY RANGE (logdate); CREATE TABLE measurement_y2016m07 PARTITION OF measurement ( unitsales DEFAULT 0 ) FOR VALUES FROM ('2016-07-01') TO ('2016-08-01'); ● 아직 못 푼 것들 ● 하위 테이블 간 이동하는 UPDATE ● 전역 색인 ● 하위 테이블 자동 생성 ● 그 외 여러 삽질들
  6. 6. 2017-11-04 6 PgDay.Seoul 2017 PostgreSQL 10 새기능 논리 복제 ● 아직 못 푼 것들 ● DDL, TRUNCATE ● 테이블 빼고 모두 안 됨 ● 교차 참조 - 충돌 해결 정책 없음 ● SQL 기반 복제 ● Promotion - 발행 구독 전환 발행 서버 구독 서버 CREATE PUBLICATION mypublication FOR TABLE users; CREATE SUBSCRIPTION mysub CONNECTION 'host=192.168.1.50' PUBLICATION mypublication; * 2ndQuadrant Postgres-BDR
  7. 7. 2017-11-04 7 PgDay.Seoul 2017 PostgreSQL 10 새기능 AS IDENTITY 칼럼 속성 postgres=# CREATE TABLE t ( a int GENERATED ALWAYS AS IDENTITY, b int); CREATE TABLE postgres=# INSERT INTO t values (1,1); 오류: "a" 칼럼에 자료를 입력할 수 없습니다 상세정보: "a" 칼럼에 GENERATED ALWAYS 속성을 지정했습니다. 힌트: 이 속성을 무시하려면 OVERRIDING SYSTEM VALUE 옵션을 사용하세요. postgres=# INSERT INTO t OVERRIDING SYSTEM VALUE values (1,1); INSERT 0 1 postgres=# SELECT * FROM t_a_seq; last_value | log_cnt | is_called ------------+---------+----------- 1 | 0 | f (1개 행) - 왜? - 좀 더 ANSI 규약을 따르려고
  8. 8. 2017-11-04 8 PgDay.Seoul 2017 PostgreSQL 10 새기능 pg_sequence 테이블 postgres=# ds 릴레이션(relation) 목록 스키마 | 이름 | 종류 | 소유주 --------+---------+--------+---------- public | t_a_seq | 시퀀스 | postgres (1개 행) postgres=# d+ t_a_seq "public.t_a_seq" 시퀀스 종류 | Start | Minimum | Maximum | Increment | Cycles? | Cache ---------+-------+---------+------------+-----------+---------+------- integer | 1 | 1 | 2147483647 | 1 | no | 1 식별 칼럼용 시퀀스: public.t.a postgres=# select * from t_a_seq; last_value | log_cnt | is_called ------------+---------+----------- 1 | 0 | f (1개 행) * 이전 버전의 시퀀스 관련 정보를 살펴보는 것은 지면 관계상 생략
  9. 9. 2017-11-04 9 PgDay.Seoul 2017 PostgreSQL 10 새기능 XMLTABLE ● 관계형 데이터베이스에서 XML 자료를 다루는 표준 함수 ● xmltable( [XMLNAMESPACES(네임스페이스정의), ] xpath값 PASSING XML자료 COLUMNS 칼럼정의 [, ...] ) ● XML 자료가 있는 테이블과 이 함수 조인 쿼리로 사용됨 ● 기존 xpath() 함수와 xml2 확장 모듈에서 할 수 있었던 것 ● 대세는 json이나 기존 XML 자료를 여전히 다뤄야 하는 환경을 끌어안는 그나마 싼 방법
  10. 10. 2017-11-04 10 PgDay.Seoul 2017 PostgreSQL 10 새기능 (9.6) postgres@postgres=# SELECT to_date('2017-02-35', 'YYYY-MM-DD'); to_date ------------ 2017-03-07 (1개 행) (10) postgres@postgres=# SELECT to_date('2017-02-35', 'YYYY-MM-DD'); 오류: 날짜/시간 필드의 값이 범위를 벗어남: "2017-02-35" UPDATE to_date(), to_timestamp() (9.6) postgres@postgres=# UPDATE measurement SET (peaktemp, unitsales) = ROW(2,2); 오류: 구문 오류, "row" 부근 (10) postgres@postgres=# UPDATE measurement SET (peaktemp, unitsales) = ROW(2,2); UPDATE 1
  11. 11. 2017-11-04 11 PgDay.Seoul 2017 PostgreSQL 10 새기능 차례 데이터 베이스 관리자 – 용어 정리 – 추가된 시스템 카탈로그 – 사용자 정의 통계 정보 – pg_stat_activity – SCRAM-SHA-256 – 병렬 쿼리 – 모니터링을 위한 롤
  12. 12. 2017-11-04 12 PgDay.Seoul 2017 PostgreSQL 10 새기능 용어 정리 ● wal와 xlog가 모두 wal로 통일함 - pg_xlog → pg_wal - pg_clog → pg_xact - pg_receivewal, pg_resetwal, pg_waldump - pg_switch_wal(), pg_walfile_name(), … ● 트랜잭션 위치가 모두 lsn으로 통일함 - df *lsn* - SELECT pg_walfile_name(pg_current_wal_lsn()); ● 서버 로그는 pg_log → log - log_line_prefix 기본값이 바뀜
  13. 13. 2017-11-04 13 PgDay.Seoul 2017 PostgreSQL 10 새기능 시스템 카탈로그 pg_hba_file_rules pg_hba.conf 내용 pg_sequences 시퀀스 pg_statistic_ext 사용자 정의 통계 정보 pg_partitioned_table 파티션 테이블 정보 pg_publication 논리 복제 발행과 구독 관련 정보들 pg_subscription ● 새로 추가된 테이블 또는 뷰 ● 새로 추가된 칼럼 pg_class.relispartition pg_class.relpartbound pg_replication_slots.temporary pg_stat_replication.write_lag pg_stat_replication.flush_lag pg_stat_replication.replay_lag pg_stat_activity.backend_type pg_attribute.attidentity
  14. 14. 2017-11-04 14 PgDay.Seoul 2017 PostgreSQL 10 새기능 사용자 정의 통계 정보 CREATE TABLE t1 ( a int, b int ); INSERT INTO t1 SELECT i/100, i/500 FROM generate_series(1,1000000) s(i); ANALYZE t1; EXPLAIN ANALYZE SELECT * FROM t1 WHERE (a = 1) AND (b = 0); QUERY PLAN ------------------------------------------------------ Seq Scan on t1 (cost=0.00..19425.00 rows=1 width=8) Filter: ((a = 1) AND (b = 0)) (2개 행) CREATE STATISTICS s1 (dependencies) ON a, b FROM t1; ANALYZE t1; QUERY PLAN ------------------------------------------------------- Seq Scan on t1 (cost=0.00..19425.00 rows=98 width=8) Filter: ((a = 1) AND (b = 0)) (2개 행)
  15. 15. 2017-11-04 15 PgDay.Seoul 2017 PostgreSQL 10 새기능 SCRAM-SHA-256 ● password_encryption = plain 설정이 없어짐 ● md5 또는 scram-sha-256 둘 중 하나 ● pg_hba.conf에서 md5는 scram-sha-256 인증을 포함함 ● pg_authid.rolpassword 값이 이미 scram-sha-256 암호화를 했다면 클라이언트가 그 인증 방법을 사용할 수 있어야 함 postgres=# set password_encryption = 'scram-sha-256'; SET postgres=# alter role postgres password 'mypassword'; ALTER ROLE postgres=# q [postgres@centos7 data10]$ /postgres/9.6/bin/psql psql: 10 인증 방법이 지원되지 않음 [postgres@centos7 data10]$ /postgres/10/bin/psql 암호: psql (10.0) 도움말을 보려면 "help"를 입력하십시오.
  16. 16. 2017-11-04 16 PgDay.Seoul 2017 PostgreSQL 10 새기능 병렬 쿼리 ● min_parallel_relation_size 환경 설정이 min_parallel_index_scan_size, min_parallel_table_scan_size 두 개로 변경됨 ● max_parallel_workers_per_gather 환경 설정값의 초가값이 0에서 2로 바뀜 → 기본 설정이 병렬 쿼리를 쓸 수 있는 상황이라면 적극적으로 쓰겠다를 의미함 ● max_connections 값을 잘 설계해야 함 클라이언트 접속 수보다 최대 8배(max_parallel_workers)가 많아질 수 있음 ● postgres_fdw 모듈을 사용하는 외부 테이블에 대한 병렬 쿼리를 확인 못 해 봤음
  17. 17. 2017-11-04 17 PgDay.Seoul 2017 PostgreSQL 10 새기능 모니터링을 위한 롤 [postgres@centos7 ~]$ /postgres/10/bin/psql -U ioseph postgres postgres=> show hba_file; 오류: "hba_file" 설정값을 알려면 pg_read_all_settings의 맴버이거나 슈퍼유저여야합니다 postgres=> c - postgres 접속정보: 데이터베이스="postgres", 사용자="postgres". postgres=# grant pg_read_all_settings to ioseph; GRANT ROLE postgres=# c - ioseph 접속정보: 데이터베이스="postgres", 사용자="ioseph". postgres=> show hba_file; ... postgres=> select rolname from pg_roles; rolname ---------------------- pg_monitor pg_read_all_settings pg_read_all_stats pg_stat_scan_tables pg_signal_backend
  18. 18. 2017-11-04 18 PgDay.Seoul 2017 PostgreSQL 10 새기능
  19. 19. 2017-11-04 19 PgDay.Seoul 2017 PostgreSQL 10 새기능 더 살펴볼 거리 ● PostgreSQL 10 릴리즈 노트 ● Wiki.postgresql.org 의 New in postgres 10 ● 예제로 살펴보는 PostgreSQL 10 새기능 ● PostgreSQL 10 언론 보도 자료 속 링크들 [링크1] [링크2]
  20. 20. 2017-11-04 20 PgDay.Seoul 2017 PostgreSQL 10 새기능 발표 마지막 장표입니다. 함께 해 주셔서 고맙습니다.

×