# PostgreSQL 설정 - Synology DS1525+ 최적화 (32GB RAM) # /volume1/docker/document-server/config/postgresql.conf # 메모리 설정 (32GB RAM 환경) shared_buffers = 8GB # RAM의 25% (8GB) effective_cache_size = 24GB # RAM의 75% (24GB) work_mem = 256MB # 복잡한 쿼리용 (정렬, 해시 조인) maintenance_work_mem = 2GB # 인덱스 구축, VACUUM용 # 체크포인트 설정 (SSD 최적화) checkpoint_completion_target = 0.9 # 체크포인트 분산 (SSD 수명 연장) checkpoint_timeout = 15min # 체크포인트 간격 max_wal_size = 4GB # WAL 파일 최대 크기 min_wal_size = 1GB # WAL 파일 최소 크기 # WAL 설정 wal_buffers = 64MB # WAL 버퍼 크기 wal_writer_delay = 200ms # WAL 쓰기 지연 commit_delay = 0 # 커밋 지연 (SSD에서는 0) # 비용 기반 최적화 (SSD 환경) random_page_cost = 1.1 # SSD는 랜덤 액세스가 빠름 seq_page_cost = 1.0 # 순차 액세스 기준값 cpu_tuple_cost = 0.01 # CPU 튜플 처리 비용 cpu_index_tuple_cost = 0.005 # 인덱스 튜플 처리 비용 cpu_operator_cost = 0.0025 # 연산자 처리 비용 # 연결 설정 max_connections = 200 # 최대 연결 수 superuser_reserved_connections = 3 # 슈퍼유저 예약 연결 # 쿼리 플래너 설정 default_statistics_target = 100 # 통계 정확도 constraint_exclusion = partition # 파티션 제약 조건 최적화 enable_partitionwise_join = on # 파티션별 조인 최적화 enable_partitionwise_aggregate = on # 파티션별 집계 최적화 # 백그라운드 작업자 설정 max_worker_processes = 8 # 최대 워커 프로세스 (CPU 코어 수) max_parallel_workers_per_gather = 4 # 병렬 쿼리 워커 max_parallel_workers = 8 # 전체 병렬 워커 max_parallel_maintenance_workers = 4 # 병렬 유지보수 워커 # 자동 VACUUM 설정 autovacuum = on # 자동 VACUUM 활성화 autovacuum_max_workers = 3 # VACUUM 워커 수 autovacuum_naptime = 1min # VACUUM 실행 간격 autovacuum_vacuum_threshold = 50 # VACUUM 임계값 autovacuum_analyze_threshold = 50 # ANALYZE 임계값 autovacuum_vacuum_scale_factor = 0.2 # VACUUM 스케일 팩터 autovacuum_analyze_scale_factor = 0.1 # ANALYZE 스케일 팩터 # 로깅 설정 log_destination = 'stderr' # 로그 출력 대상 logging_collector = off # Docker 환경에서는 off log_min_messages = warning # 최소 로그 레벨 log_min_error_statement = error # 에러 문장 로그 log_min_duration_statement = 1000 # 1초 이상 쿼리 로깅 log_checkpoints = on # 체크포인트 로깅 log_connections = off # 연결 로깅 (성능상 off) log_disconnections = off # 연결 해제 로깅 (성능상 off) log_lock_waits = on # 락 대기 로깅 log_temp_files = 10MB # 임시 파일 로깅 (10MB 이상) # 전문 검색 설정 default_text_search_config = 'pg_catalog.english' # 시간대 설정 timezone = 'Asia/Seoul' log_timezone = 'Asia/Seoul' # 문자 인코딩 lc_messages = 'C' lc_monetary = 'C' lc_numeric = 'C' lc_time = 'C' # 기타 성능 설정 effective_io_concurrency = 200 # SSD 동시 I/O (SSD는 높게) maintenance_io_concurrency = 10 # 유지보수 I/O 동시성 wal_compression = on # WAL 압축 (디스크 절약) full_page_writes = on # 전체 페이지 쓰기 (안정성) # JIT 컴파일 설정 (PostgreSQL 11+) jit = on # JIT 컴파일 활성화 jit_above_cost = 100000 # JIT 활성화 비용 임계값 jit_inline_above_cost = 500000 # 인라인 JIT 비용 임계값 jit_optimize_above_cost = 500000 # 최적화 JIT 비용 임계값 # 확장 모듈 설정 shared_preload_libraries = 'pg_stat_statements' # 쿼리 통계 모듈