fsync体会
看这个链接:http://www.postgresql.org/docs/9.1/static/runtime-config-wal.html
是这样说的:
fsync (boolean)
If this parameter is on, the PostgreSQL server will try to make sure that updates are physically written to disk, by issuing fsync() system calls or various equivalent methods (see wal_sync_method). This ensures that the database cluster can recover to a consistent state after an operating system or hardware crash. While turning off fsync is often a performance benefit, this can result in unrecoverable data corruption in the event of a power failure or system crash. Thus it is only advisable to turn off fsync if you can easily recreate your entire database from external data. Examples of safe circumstances for turning off fsync include the initial loading of a new database cluster from a backup file, using a database cluster for processing a batch of data after which the database will be thrown away and recreated, or for a read-only database clone which gets recreated frequently and is not used for failover. High quality hardware alone is not a sufficient justification for turning off fsync. In many situations, turning off synchronous_commit for noncritical transactions can provide much of the potential performance benefit of turning off fsync, without the attendant risks of data corruption. fsync can only be set in the postgresql.conf file or on the server command line. If you turn this parameter off, also consider turning off full_page_writes.
我的实验:
把 postgresql.conf 中的 fsync 设置为off之后,再来看sql执行动作:
pgsql=# select * from test;
textcol | intcol
---------+--------
a | 1
a | 2
b | 5
b | 6
(4 rows) pgsql=#
pgsql=# show fsync;
fsync
-------
off
(1 row) pgsql=#
执行操作:
begin;
insert into test values('aaaaa',12345);
commit;
然后直接关机,使得OS级别的缓存没有机会写入磁盘。
再次开机看数据,发现上述数据没有保存:
pgsql=# select * from test;
textcol | intcol
---------+--------
a | 1
a | 2
b | 5
b | 6
(4 rows) pgsql=#
fsync体会的更多相关文章
- Linux就这个范儿 第15章 七种武器 linux 同步IO: sync、fsync与fdatasync Linux中的内存大页面huge page/large page David Cutler Linux读写内存数据的三种方式
Linux就这个范儿 第15章 七种武器 linux 同步IO: sync.fsync与fdatasync Linux中的内存大页面huge page/large page David Cut ...
- SVM一点心得体会
支持向量机的学习说是刚刚开始,又不合理,只能说隔了很长的时间再看,终于在分类这块的层面上有了新的认识. 总的来说,支持向量机分为线性支持向量机和非线性支持向量机,线性支持向量机又可以分为硬间隔最大化线 ...
- C Primer Plus 学习体会
本月刚刚开始学习<C primer plus>,之前课上草草学过一遍,讲到指针就结束了.现在重新开始看感觉难度不大只是刚开始接触有些语言细节比较琐碎.学习这一周的体会如下: 诸多前辈推荐的 ...
- 关于Solr的使用总结的心得体会
摘要:在项目中使用Solr作为搜索引擎对大数据量创建索引,提供服务,本文是作者对Solr的使用总结的一点心得体会, 具体包括使用DataImportHandler从数据库中近实时同步数据.测试Solr ...
- <2048>调查报告心得与体会
老师这次给我们布置了一个任务,就是让我们写一份属于自己的调查报告,针对这个任务,我们小组的六个人通过积极的讨论,提出了一些关于我们产品的问题,当然这些问题并不是很全面,因为我们是从自己的角度出发,无法 ...
- 一个ERP项目实施工程师的若干体会
本人在多年的工作中,参与了ERP的研发和实施,对ERP有较深的认识.在这里,根据自已的实施过程中的一些经历,把自已在实践中的一些体会贡献出来和大家共享,由于时间和精力所限,内容难免有不当之处,挂一漏万 ...
- 如何阅读Java源码 阅读java的真实体会
刚才在论坛不经意间,看到有关源码阅读的帖子.回想自己前几年,阅读源码那种兴奋和成就感(1),不禁又有一种激动. 源码阅读,我觉得最核心有三点:技术基础+强烈的求知欲+耐心. 说到技术基础,我打个比 ...
- 【转载】科研ppt制作的体会
转载自实验室陈家雷学长发在bbs 上的帖子,讲解了自己制作ppt的心得体会.学习下. 附件中是我昨天晚上我的组会ppt的pdf版本,另外我对ppt的制作有点自己的理解,基本上都是去年暑假在Harvar ...
- 通过GitHub Pages建立个人站点总结与体会
通过GitHub Pages建立个人站点总结与体会 ----Git+Github+Jekyll+Markdown blog Git (不会?请参照简易教程学习Git的总结) 首先感谢雨知网站作者博文指 ...
随机推荐
- 高效实时的网络会议数据传输库—UDT
在视频会议系统的研发当中,我们的音.视频数据必须要有相应的可靠性作为保障,因为视频会议系统是一个实时性非常强的系统,如果其数据在网络不太好的情况下,有可能会出现丢包.数据延迟.数据堵塞等现象,出现这些 ...
- bzoj 3028 生成函数
计算完后为 f(x): 根据我翻高数书,终于推倒出来了. (- ̄▽ ̄)-
- UVA515 King
嘟嘟嘟 题目翻译:有n个数,m个限制条件.每一个限制条件形如:1.x y gt c:表示ax + ax+1 + … +ay > c.2.x y It c:表示ax + ax+1 + …… +ay ...
- 未启用当前数据库的 SQL Server Service Broker,请为此数据库启用 Service Broker
ALTER DATABASE DATABASE_Name SET NEW_BROKER WITH ROLLBACK IMMEDIATE; ALTER DATABASE DATABASE_Name SE ...
- socket 代码实例
1. TCP SOCKET 客户端: #!/usr/bin/env python # -*-coding:utf-8 -*- import socket HOST = 'localhost' PO ...
- deep learning学习记录二
接着我的微博继续八卦吧 微博里问了几个人,关于deep learning和cnn的区别,有不少热心网友给了回答,非常感谢.结合我听课和看文章的理解,我大胆大概总结一下: 在上世纪90年代,neural ...
- springboot 整合dubbo 消费模块引入springboot 之后自动注入jdbc 模块导致启动报错问题
方案一: 排除方法 pom文件直接将数据起步模块内排除数据源自动注入 jdbc jar <!--mybatis-plus 集成 --><!--mybitis--><dep ...
- 跨Vlan通信:单臂路由,三层交换机
实验涉及命令以及知识补充(涉及Vlan通过的以太网口需要设置为Trunk口) 单臂路由 父接口 no ip address :删除实现单臂路由接口的IP no shutdown 虚拟子接口 R2(co ...
- MySQL数据库主从(主主)配置
一.系统环境: centos7.4 (centos 1708) mysql 5.7 master主机的IP地址为192.168.159.50 slave主机的IP地址为192.168.159.51 M ...
- chromium之pickle
pickle谷歌翻译成泡菜 醉了,看一下头文件的说明 // This class provides facilities for basic binary value packing and unpa ...