본문 바로가기 메뉴 바로가기

DB스토리

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

DB스토리

검색하기 폼
  • 분류 전체보기 (121)
    • DataBase (101)
      • Oracle (82)
      • Postgresql (10)
      • MS_SQL (6)
      • MY_SQL (4)
      • SQL (3)
    • Google Analytics (0)
    • VB.NET (2)
    • LInux (1)
    • 잡다정보 (18)
  • 방명록

DataBase/Postgresql (10)
postgresql 파티션 테이블 생성 및 데이터 이관

운영 중 이력테이블의 사이즈가 커져서 RDS용량 증가 문제 발생.문제해결방안으로 파티션테이블로 만들고 오래된 하위테이블은 S3로 백업 후 삭제. 1. 파티션 테이블 생성CREATE TABLE IF NOT EXISTS change_history_p( history_sn bigint NOT NULL DEFAULT nextval('change_history_p_history_sn_seq'::regclass), ... change_dt timestamp with time zone NOT NULL) PARTITION BY RANGE (change_dt);2. 하위테이블 생성CREATE TABLE change_history_p_y202305 PARTITION OF change_history_p FO..

DataBase/Postgresql 2024. 5. 9. 14:01
테이블 사이즈 확인

select schemaname ,relname as "Table" ,pg_size_pretty(pg_total_relation_size(relid)) as "size" ,pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "external size" ,now() from pg_catalog.pg_statio_user_tables where 1=1 order by schemaname,pg_total_relation_size(relid) desc;

DataBase/Postgresql 2019. 8. 13. 10:50
role에 속한 계정 조회

select a.rolname as "role",c.rolname as "role에 속한계정",d.rolname as "작업계정" from pg_roles a join pg_auth_members b on a.oid = b.roleid join pg_roles c on c.oid= b.member join pg_roles d on d.oid= b.grantor order by 1;

DataBase/Postgresql 2019. 8. 13. 10:48
테이블단위 autovacuum 끄기

postgresql에서 대량 이관 작업시 auto vacuum이 켜져 있으면 이관중에 vacuum이 실행되는 문제가 발생하여 이관이 오래 걸림. 대상 테이블 autovacuum 끄기 select 'alter table '||table_schema||'.'||table_name||' set (autovacuum_enabled=false);'from information_schema.tableswhere table_schema = '스키마명' and table_name = '테이블명'; 대상 테이블 autovacuum 다시 켜기select 'alter table '||table_schema||'.'||table_name||' set (autovacuum_enabled=true);' from informati..

DataBase/Postgresql 2019. 8. 13. 10:46
이전 1 2 3 다음
이전 다음
반응형
최근에 올라온 글
Total
Today
Yesterday
TAG
  • Backup
  • 아이폰4
  • postgresql pg_stat_activity
  • linux
  • 독도
  • index
  • 오라클
  • 투싼
  • PostgreSQL
  • 아이폰
  • tablespace
  • parameter
  • 출시일
  • 인덱스
  • 윈도우
  • 리눅스
  • Managing Schema Objects
  • MS-SQL
  • iPhone
  • query 잘림
  • oracle
  • iOS5
  • 갤럭시S
  • 한글
  • Flashback
  • postgresql jsonb
  • postgresql jsonb index
  • SQLPlus
  • recovery
  • PL/SQL
more
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바