Some settings of PostgreSQL
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 = 16MBThen, as a setting refinement, check if checkpoints happen more often than checkpoint_timeout,
checkpoint_completion_target = 0.9
checkpoint_timeout = 10m-30m # Depends on restart time
checkpoint_segments = 32 # As a start value
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的更多相关文章
- PostgreSQL Configuration – managing scary settings
When it comes to highly available database servers and configuration, a very important aspect is whe ...
- PostgreSQL 非持久化设置(Non-Durable Settings)
Durability is a database feature that guarantees the recording of committed transactions even if the ...
- postgresql on centos (sequelize+pg+nodejs):Failed to find PostgresSQL server.Pleast double check your settings
公司的一个项目,使用的nodejs做服务端,数据库是postgresql,在本地时一切ok,放在centos时,postgresql配置ok,可以远程访问,但是nodejs在centos启动时,就会报 ...
- 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 ...
- 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 ...
- PostgreSQL的OGG -- bucardo
bucardo是PostgreSQL数据库中实现双向同步的软件,可以实现PostgreSQL数据库的双master的方案,不过bucardo中的同步都是异步的,它是通过触发器记录变化,程序是perl写 ...
- postgresql 锁的定位
今天碰到了一个问题,锁定穷根追底把postgresql的锁研究了一番. 数据库查看锁 可以通过表 pg_locks来查看有哪些锁.sql如下: select a.locktype,a.database ...
- How to debug PostgreSQL function with pgAdminIII
How to debug plpgsql with pgAdminIII [root@localhost soft_bak]# git clone git://git.postgresql.org/g ...
- PostgreSQL Insight Monitor pgstat
PostgreSQL Insight Monitor pgstat pgstat 是一个连接到数据库并获取数据库的活动状态的命令行工具. PostgreSQL有许多状态: archiver for ...
随机推荐
- Java管道流
管道流的主要作用可以用于两个线程之间的通信,有管道输出流 PipeOutputStream和管道输入流 PipeInputStream.然后通过connect将两个管道连接起来. import jav ...
- css伪元素before/after和画三角形的搭配应用
想要实现的效果如下: 第一步:如何用css画出三角形? /* css画三角形 */ .sanjiao{ ; border-top:40px solid red; border-bottom:40px ...
- hibernate多SessionFactory配置
<bean id="aDataSource" class="org.apache.commons.dbcp.BasicDataSource" destro ...
- C语言PRO2
2-5 #include<stdio.h>#include<math.h>int main(){ int money , year; double rate , sum; pr ...
- 变长数组列表ArrayList
简介:此数据结构定义为一个ArrayList结构体类型,维护了一个内部堆数组.通过realloc函数实现了数组容量自动扩充,每次扩充到原来的2倍. 通过函数指针实现了使用者根据自己的需求按条件按查找目 ...
- 通过全局设置过滤器,就能让所有窗口都可移动,而不是都要继承指定QDialog
#include "appinit.h" #include <QMouseEvent> #include <QApplication> #include & ...
- ubuntu下的jdk安装
软件环境: 虚拟机:VMware Workstation 10 操作系统:ubuntu-12.04-desktop-amd64 JAVA版本:jdk-7u55-linux-x64 软件下载地址: JD ...
- Jquery 多选下拉列表插件jquery multiselect
有一个多选的需求,在网上找到了这个插件:multiselect https://github.com/ehynds/jquery-ui-multiselect-widget csdn博客上有这个插件的 ...
- JS之Array.slice()方法
1.Array.slice(startIndex,endIndex); 返回由原始数组从startIndex到endIndex-1的元素构成的新数组; startIndex:默认值0,如果startI ...
- linux i2c 设备节点读写
最近需要操作24C02,封装了一下函数方便以后操作. 参考链接: https://my.oschina.net/handawei/blog/68526 http://blog.csdn.net/one ...