# PostgreSQL 生产环境配置
# 针对 QAUP 应用优化

# 连接设置
listen_addresses = '*'
port = 5432
max_connections = 200
superuser_reserved_connections = 3

# 内存设置
shared_buffers = 256MB
effective_cache_size = 1GB
work_mem = 4MB
maintenance_work_mem = 64MB

# 检查点设置
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100

# 日志设置
logging_collector = on
log_directory = 'pg_log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_age = 1d
log_rotation_size = 100MB
log_min_duration_statement = 1000
log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '
log_checkpoints = on
log_connections = on
log_disconnections = on
log_lock_waits = on

# 性能优化
random_page_cost = 1.1
effective_io_concurrency = 200

# 自动清理设置
autovacuum = on
autovacuum_max_workers = 3
autovacuum_naptime = 1min

# 时区设置
timezone = 'Asia/Shanghai'
log_timezone = 'Asia/Shanghai'

# 字符集设置
lc_messages = 'en_US.UTF-8'
lc_monetary = 'en_US.UTF-8'
lc_numeric = 'en_US.UTF-8'
lc_time = 'en_US.UTF-8'

# 默认文本搜索配置
default_text_search_config = 'pg_catalog.english'