'2019/10/16'에 해당되는 글 3건

  1. 2019.10.16 postgresql vacuum
  2. 2019.10.16 pgadmin4 분석기능
  3. 2019.10.16 postgres regexp_matches() 매칭되는 것이 없을 경우

vacuum full 을 하면 db 끊고

다시 복사해서 새로운 데이터베이스로 생성하면서

용량을 줄이는 등의 최적화를 하고

 

vacuum verbose analyze 를 하면 간략하게 끊지 않고도 할 수 있다고 한다.

 

다만 디스크 스토리지 줄이는건 full만 된다고.

 

[링크 : https://blog.gaerae.com/2015/09/postgresql-vacuum-fsm.html]

[링크 : https://bstar36.tistory.com/308]

 

아래의 명령으로 자동 정리가 켜져있는지 확인가능하다고 한다.

show autovacuum;

[링크 : http://hochul.net/blog/postgresql-vacuum-optimization/?ckattempt=1]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

subquery  (0) 2019.10.20
array_agg() 여러개 컬럼 합치기  (0) 2019.10.18
pgadmin4 분석기능  (0) 2019.10.16
postgres regexp_matches() 매칭되는 것이 없을 경우  (0) 2019.10.16
sql 결과 공백 제거  (0) 2019.10.15
Posted by 구차니

explain analyze

전에 어떻게 쓰는법 찾았다가 까먹은건가.. 기억이 잘 안나네..

 

+

아래 링크는 개발버전

[링크 : https://www.pgadmin.org/docs/pgadmin4/development/query_tool.html]

 

요게 현재최신 버전. 여기서는 위에 처럼 다양하게 나오진 않는다.

[링크 : https://www.pgadmin.org/docs/pgadmin4/4.13/query_tool.html]

Posted by 구차니

regexp_matches()를 select에서 쓸 경우

해당 매치가 되지 않는 항목에 대해서는 버려진다 -ㅁ-!

즉, 1000개 중에 매칭되지 않는게 200개가 있으면

800개만 나오는데

매치 되지 않는 녀석들을 뽑아 내려면 아래와 같은 트릭을 쓰면 된다고 한다.

일단은 나의 경우에는 null 이었고, null을 내보내 주긴 하는데 값이 있는데 매칭이 안되는건 모르겠네?

with test_data as (
  select 'abc 123' as txt
  union
  select 'abc 456' as txt
  union
  select 'blah' as txt
)

select
  txt,
  (select regexp_matches(txt, '\d+'))[1] as first_num
from
  test_data

[링크 : https://dba.stackexchange.com/questions/210047/postgres-return-default-value-if-regex-match-fails]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql vacuum  (0) 2019.10.16
pgadmin4 분석기능  (0) 2019.10.16
sql 결과 공백 제거  (0) 2019.10.15
postgres 배열 처리하기  (0) 2019.10.15
sql with ,  (0) 2019.10.10
Posted by 구차니