
不太想花太多時間在這上面。因為 postgresql 的效能效益並不是很好。
tpcc測試時,tpm/tps的數字也極其難看。
這次選定的版本是 postgresql 9.x or 10,記得 postgresql 沒有支援 linux aio,這大概也是她效能不好的原因之一。
1. 安裝
https://www.postgresql.org/download/linux/redhat/
2. Modify pg_hba.conf indent to md5
3. Change postgress passwd by “passwd” cli
4. Change postgres passwd by
# su – postgres
$ psql
ALTER USER postgres WITH PASSWORD ‘postgres’;
5. go to pgtune web site (http://pgtune.leopard.in.ua/) to tune db conf
# 以下是常用的
# Add settings for extensions here (for 10)
max_connections = 100
shared_buffers = 6GB
effective_cache_size = 18GB
work_mem = 62914kB
maintenance_work_mem = 1536MB
min_wal_size = 2GB
max_wal_size = 4GB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 4
synchronous_commit = off -> 這行決定了你的DB效能更高
commit_delay = 0