PostgreSQL 非持久化设置(Non-Durable Settings)
2015-12-08 16:48
375 查看
Durability is a database feature that guarantees the recording of committed transactions even if the server crashes or loses power. However, durability adds significant database overhead, so if your site does not require such a guarantee, PostgreSQL can be configured to run much faster. The following are configuration changes you can make to improve performance in such cases. Except as noted below,durability is still guaranteed in case of a crash of the database software; only abrupt operating system stoppage creates a risk of data loss or corruption when these settings are used.
• Place the database cluster’s data directory in a memory-backed file system (i.e. RAM disk). This
eliminates all database disk I/O, but limits data storage to the amount of available memory (and perhaps swap).
• Turn off fsync; there is no need to flush data to disk.
• Turn off synchronous_commit; there might be no need to force WAL writes to disk on every commit.
This setting does risk transaction loss (though not data corruption) in case of a crash of the
database.
• Turn off full_page_writes; there is no need to guard against partial page writes.
• Increase checkpoint_segments and checkpoint_timeout ; this reduces the frequency of checkpoints,
but increases the storage requirements of /pg_xlog.
• Create unlogged tables to avoid WAL writes, though it makes the tables non-crash-safe.
[root@DELL-R720 data]# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
2
[root@DELL-R720 data]# cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 6
[root@DELL-R720 data]# cat /proc/cpuinfo| grep "processor"| wc -l
24
[root@DELL-R720 data]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
24 Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
• Place the database cluster’s data directory in a memory-backed file system (i.e. RAM disk). This
eliminates all database disk I/O, but limits data storage to the amount of available memory (and perhaps swap).
• Turn off fsync; there is no need to flush data to disk.
• Turn off synchronous_commit; there might be no need to force WAL writes to disk on every commit.
This setting does risk transaction loss (though not data corruption) in case of a crash of the
database.
• Turn off full_page_writes; there is no need to guard against partial page writes.
• Increase checkpoint_segments and checkpoint_timeout ; this reduces the frequency of checkpoints,
but increases the storage requirements of /pg_xlog.
• Create unlogged tables to avoid WAL writes, though it makes the tables non-crash-safe.
[root@DELL-R720 data]# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
2
[root@DELL-R720 data]# cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 6
[root@DELL-R720 data]# cat /proc/cpuinfo| grep "processor"| wc -l
24
[root@DELL-R720 data]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
24 Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
相关文章推荐
- SQL注入原理
- oracle 常用函数
- sqlload的使用
- MySql相关及如何删除MySql服务
- MySQL 配置优化
- MongoDB学习(三):MongoDB Shell的使用
- Redis入门很简单之二【常见操作命令】
- Redis入门很简单之一【简介与环境搭建】
- MySQL插入百万条测试数据
- ehcache memcache redis 三大缓存区别
- mysql主从同步常见异常及恢复方法
- Oracle 10.2.0.5又出现了undo 表空间使用率不断增长
- java oracle传入和取得自定义数组(二维数组)
- mysql5.6 无法使用64odbc连接
- 批量更新服务器上所有用户数据库中的某张表
- Redis实战经验及使用场景
- 学习oracle里面触发器的功能作用,举一个例子来说明:
- EAS如何记录执行业务中记录执行sql的步骤
- MySQL数据导出与导入
- oracle imp导入库到指定表空间