通过更改配置参数来调整PostgreSQL

时间:2017-01-23 22:36:11

标签: performance postgresql configuration config postgresql-9.6

我有 postgresql 9.6 ,它在ubuntu服务器16.04上运行,在AWS上有122gb RAM320gb SSD18 vCPU。我想知道根据这些资源我需要在postgresql.config文件中更改哪些参数才能获得高性能? 如何强制postgresql尽可能多地在内存中加载数据?

1 个答案:

答案 0 :(得分:1)

为了快速入门,您可以使用pgtune util或web alternative http://pgtune.leopard.in.ua。 我们假设您编写了Web应用程序:

# WARNING
# this tool not being optimal 
# for very high memory systems

max_connections = 200
shared_buffers = 31232MB
effective_cache_size = 93696MB
work_mem = 159907kB
maintenance_work_mem = 2GB
min_wal_size = 1GB
max_wal_size = 2GB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100