Here are some setting recommendations about checkpoints, some values to set in postgresql.conf. A checkpoint consists of a complete flush of dirty buffers to disk, so it potentially generates a lot of I/O. The performance of your system will be impacted in those cases:

  • A particular number of WAL segments have been written
  • Timeout occurs

Here are some settings.

wal_buffers = 16MB
checkpoint_completion_target = 0.9
checkpoint_timeout = 10m-30m # Depends on restart time
checkpoint_segments = 32 # As a start value
Then, as a setting refinement, check if checkpoints happen more often than checkpoint_timeout,
adjust checkpoint_segments so that checkpoints happen due to timeouts rather filling segments.
Also, do not forget that WAL can take up to 3 * 16MB * checkpoint_segments on disk, and that restarting
PostgreSQL can take up to checkpoint_timeout (but usually less).

General

Logging has little impact on the system, so even large values are OK. Good source of information to find

performance bottlenecks and tune the system. Preferential settings for logging information in postgresql.conf.

Place where to log, they depend on the system and external tools you are using with your system.

  • syslog
  • standard format to files, you might be using tools for standard formats
  • CVS format to files

Some parameters to use.

log_destination = 'csvlog'
log_directory = 'pg_log'
logging_collector = on
log_filename = 'postgres-%Y-%m-%d_%H%M%S'
log_rotation_age = 1d
log_rotation_size = 1GB
log_min_duration_statement = 200ms
log_checkpoints = on
log_connections = on
log_disconnections = on
log_lock_waits = on
log_temp_files = 0

syslog

When using syslog-ng, set up those parameters in /etc/syslog-ng/syslog-ng.conf.

destination postgres { file("/var/log/pgsql"); };
filter f_postgres { facility(local0); };
log { source(src); filter(f_postgres); destination(postgres); };

Then set those parameters in postgresql.conf.

log_destination = 'stderr,syslog' # Can specify multiple destinations
syslog_facility='LOCAL0'
syslog_ident='postgres'

Then reload parameters (no restart necessary).

pg_ctl reload -D $PGDATA

Here is a list of recommended parameters for memory management in PostgreSQL.

You should take into account mainly the following parameters.

shared_buffers
work_mem
maintenance_work_mem
effective_cache_size

About shared_buffers:

  • Below 2GB, set to 20% of total system memory.
  • Below 32GB, set to 25% of total system memory.
  • Above 32GB, set to 8GB

About work_mem, this parameter can cause a huge speed-up if set properly,

however it can use that amount of memory per planning node. Here are some

recommendations to set it up.

  • Start low: 32-64MB
  • Look for ‘temporary file’ lines in logs
  • Set to 2-3x the largest temp file

About maintenance_work_mem, here are some recommandations:

  • 10% of system memory, up to1GB
  • Maybe even higher if you are having VACUUM problems

About effective_cache_size, here are some guidelines.

  • Set to the amount of file system cache available
  • If you don’t know, set it to 50% of total system memory

Here are a couple of tips for planner settings.

  • effective_io_concurrency, set to the number of I/O channels or ignore it
  • random_page_cost
  • 3.0 for a typical RAID10 array
  • 2.0 for a SAN
  • 1.1 for Amazon EBS
 http://michael.otacoo.com/manuals/postgresql/

Some settings of PostgreSQL的更多相关文章

  1. PostgreSQL Configuration – managing scary settings

    When it comes to highly available database servers and configuration, a very important aspect is whe ...

  2. PostgreSQL 非持久化设置(Non-Durable Settings)

    Durability is a database feature that guarantees the recording of committed transactions even if the ...

  3. postgresql on centos (sequelize+pg+nodejs):Failed to find PostgresSQL server.Pleast double check your settings

    公司的一个项目,使用的nodejs做服务端,数据库是postgresql,在本地时一切ok,放在centos时,postgresql配置ok,可以远程访问,但是nodejs在centos启动时,就会报 ...

  4. PostgreSQL configuration file postgresql.conf recommanded settings and how it works

    1        Set max_connections to three times the number of processor cores on the server. Include vir ...

  5. postgresql利用pg_upgrade升级数据库(从8.4升级到9.5)

    其他见:http://my.oschina.net/ensn/blog/636766 本文利用pg_upgrade实现将8.4.18版本升级到9.5.0版本,8.4.18版本为RedHat系统自带pg ...

  6. PostgreSQL的OGG -- bucardo

    bucardo是PostgreSQL数据库中实现双向同步的软件,可以实现PostgreSQL数据库的双master的方案,不过bucardo中的同步都是异步的,它是通过触发器记录变化,程序是perl写 ...

  7. postgresql 锁的定位

    今天碰到了一个问题,锁定穷根追底把postgresql的锁研究了一番. 数据库查看锁 可以通过表 pg_locks来查看有哪些锁.sql如下: select a.locktype,a.database ...

  8. How to debug PostgreSQL function with pgAdminIII

    How to debug plpgsql with pgAdminIII [root@localhost soft_bak]# git clone git://git.postgresql.org/g ...

  9. PostgreSQL Insight Monitor pgstat

    PostgreSQL Insight Monitor  pgstat pgstat 是一个连接到数据库并获取数据库的活动状态的命令行工具. PostgreSQL有许多状态: archiver for ...

随机推荐

  1. gcc的-D和-U参数:宏的设置与取消

    http://blog.chinaunix.net/uid-7213338-id-2658068.html  gcc的-D和-U参数:宏的设置与取消 2006-10-08 22:59:06 分类: L ...

  2. sqlserver中常用的全局变量

    变量 Transact-SQL语言中有两种形式的变量,一种是用户自己定义的局部变量,另外一种是系统提供的全局变量.局部变量 局部变量是一个能够拥有特定数据类型的对象,它的作用范围仅限制在程序内部.局部 ...

  3. HDFS中高可用性HA的讲解

    HDFS Using QJM HA使用的是分布式的日志管理方式 一:概述 1.背景 如果namenode出现问题,整个HDFS集群将不能使用. 是不是可以有两个namenode呢 一个为对外服务-&g ...

  4. ADO,OLEDB,ODBC,DAO的区别【转】

    转载:http://blog.csdn.net/sunboy_2050/article/details/6624684 ODBC(Open Database Connectivity,开放数据库互连) ...

  5. SVN命令详解

    在开发中,除了在本机文件夹上进行svn更新外,在命令行中进行svn操作也非常关键,下面列举下网站摘抄的一些文档:1.将文件checkout到本地目录 svn checkout path(path是服务 ...

  6. Weak Pair---hud5877大连网选(线段树优化+dfs)

    题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5877  题意:给你一颗树,有n个节点,每个节点都有一个权值v[i]:现在求有多少对(u,v ...

  7. VMware中CentOS设置静态IP

    因为之前搭建的MongoDB分片没有采用副本集,最近现网压力较大,所以准备研究一下,于是在自己电脑的虚拟机中搭建环境,但是发现之前VMware设置的是DHCP,所以每次重新resume后虚拟机中IP都 ...

  8. c#中DropDownList控件绑定枚举数据

    c# asp.net 中DropDownList控件绑定枚举数据 1.枚举(enum)代码: private enum heros { 德玛 = , 皇子 = , 大头 = , 剑圣 = , } 如果 ...

  9. imx6 system boot

    imx6开机启动就进入download模式,有的板子进入文件系统之后会进入download模式.查看datasheet,Chapter 8 System Boot查找原因,记录于此. freescal ...

  10. CXF入门例子

    1. WebService实现类:@WebService注解表示这个类发布为一个WebService服务. package com.coshaho.learn.cxf; import javax.jw ...