Files
st/deploy/postgres/postgresql.conf

80 lines
2.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ====================================================
# PostgreSQL 配置文件(针对开发环境优化)
# ====================================================
# 连接设置
# ====================================================
listen_addresses = '*'
max_connections = 200
superuser_reserved_connections = 3
# 内存设置
# ====================================================
shared_buffers = 256MB # 共享缓冲区(推荐系统内存的 25%
effective_cache_size = 1GB # 有效缓存大小(推荐系统内存的 50-75%
maintenance_work_mem = 128MB # 维护操作内存
work_mem = 5MB # 排序和哈希表内存
# WALWrite-Ahead Logging设置
# ====================================================
wal_buffers = 16MB
min_wal_size = 1GB
max_wal_size = 4GB
checkpoint_completion_target = 0.9
# 查询优化
# ====================================================
random_page_cost = 1.1 # SSD 优化(默认 4.0
effective_io_concurrency = 200 # SSD 优化(默认 1
default_statistics_target = 100
# 日志设置
# ====================================================
logging_collector = on
log_destination = 'stderr'
log_directory = 'log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_age = 1d
log_rotation_size = 100MB
log_line_prefix = '%m [%p] %u@%d '
log_timezone = 'Asia/Shanghai'
# 慢查询日志
log_min_duration_statement = 1000 # 记录超过 1 秒的查询
log_statement = 'ddl' # 记录 DDL 语句
# 扩展配置
# ====================================================
shared_preload_libraries = 'vector' # 预加载 pgvector 扩展
# JIT 编译(提升性能)
# ====================================================
jit = on
jit_above_cost = 100000
jit_inline_above_cost = 500000
jit_optimize_above_cost = 500000
# 时区设置
# ====================================================
timezone = 'Asia/Shanghai'
# 客户端连接默认设置
# ====================================================
client_encoding = 'UTF8'
lc_messages = 'C'
lc_monetary = 'C'
lc_numeric = 'C'
lc_time = 'C'
# 并行查询设置(提升大数据量查询性能)
# ====================================================
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
max_worker_processes = 4
# 自动清理设置
# ====================================================
autovacuum = on
autovacuum_max_workers = 3
autovacuum_naptime = 1min