PostgreSQL 在 checkpoint 之后在对数据页面的第一次写的时候会将整个数据页面写到 xlog 里面。

当出现主机断电或者OS崩溃时,redo操作时通过checksum发现“部分写”的数据页,并将xlog中保存的这个完整数据页覆盖当前损坏的数据页,然后再继续redo就可以恢复整个数据库了。

记住分两步进行。

full_page_writes (boolean)

When this parameter is on, the PostgreSQL server writes the entire content of each disk page to WAL during the first modification of that page after a checkpoint. This is needed because a page write that is in process during an operating system crash might be only partially completed, leading to an on-disk page that contains a mix of old and new data. The row-level change data normally stored in WAL will not be enough to completely restore such a page during post-crash recovery. Storing the full page image guarantees that the page can be correctly restored, but at the price of increasing the amount of data that must be written to WAL. (Because WAL replay always starts from a checkpoint, it is sufficient to do this during the first change of each page after a checkpoint. Therefore, one way to reduce the cost of full-page writes is to increase the checkpoint interval parameters.)

Turning this parameter off speeds normal operation, but might lead to either unrecoverable data corruption, or silent data corruption, after a system failure. The risks are similar to turning off fsync, though smaller, and it should be turned off only based on the same circumstances recommended for that parameter.

Turning off this parameter does not affect use of WAL archiving for point-in-time recovery (PITR) (see Section 25.3).

This parameter can only be set in the postgresql.conf file or on the server command line. The default is on.

当此参数打开时,PostgreSQL服务器在检查点首次修改该页面之后,将每个磁盘页面的整个内容写入WAL。这是需要的,因为在操作系统崩溃期间正在进行的页面写入可能仅部分完成,导致包含旧数据和新数据的磁盘页面。通常存储在WAL中的行级更改数据将不足以在崩溃恢复期间完全还原此类页面。存储全页图像可确保页面能够正确恢复,但以增加必须写入WAL的数据量为代价。 (因为WAL重放总是从检查点开始,所以在检查点之后的每个页面的第一次更改过程中这样做是足够的,因此,减少全页写入成本的一种方法是增加检查点间隔参数。)

关闭此参数可以加速正常运行,但在系统发生故障后可能会导致数据不能恢复,或无声数据损坏。风险类似于关闭fsync,尽管更小,只能基于与该参数相同的情况关闭。

关闭此参数不影响使用WAL归档进行时间点恢复(PITR)(见第25.3节)。

此参数只能在postgresql.conf文件或服务器命令行中设置。默认值为开。

wal_log_hints (boolean)

When this parameter is on, the PostgreSQL server writes the entire content of each disk page to WAL during the first modification of that page after a checkpoint, even for non-critical modifications of so-called hint bits.

If data checksums are enabled, hint bit updates are always WAL-logged and this setting is ignored. You can use this setting to test how much extra WAL-logging would occur if your database had data checksums enabled.

This parameter can only be set at server start. The default value is off.

当此参数打开时,PostgreSQL服务器在检查点之后的该页面的第一次修改期间将每个磁盘页面的整个内容写入WAL,即使对所谓的提示位进行非关键修改。

如果启用数据校验和,则提示位更新始终处于WAL状态,此设置将被忽略。 您可以使用此设置来测试如果您的数据库启用了数据校验和,将会发生多少额外的WAL日志记录。

此参数只能在服务器启动时设置。 默认值为off。

PostgreSQL full_page_write记录的更多相关文章

  1. postgresql学习记录1

    数据库9.3.5,系统fedora20,不同系统操作略有不同. 使用yum 命令安装即可:sudo yum install postgresql,postgresql-server 安装完毕后系统中会 ...

  2. PostgreSQL学习记录-- 2016-03-11

    1.日期字段 “年月日”  使用 date “年月日 时分秒” 使用 timestamp without time zone 2.布尔字段 使用 boolean 3.字符字段 使用 character ...

  3. PostgreSQL常用插件收集

    hexdump -C 数据表文件 -- 查看表文件中数据. pg_stat_statements pgcompacttable -- 在减少锁的情况下,清理表和索引的老空间. pg_repack--P ...

  4. PostgreSQL - raise函数打印字符串

    raise函数 在PostgreSQL中,该函数用于打印字符串,类似于Java中的System.out.println(),Oracle中的dbms_output.put_line(). 用法如下: ...

  5. 浅析Postgres中的并发控制(Concurrency Control)与事务特性(上)

    转载:https://www.cnblogs.com/flying-tiger/p/9567213.html#4121483#undefined PostgreSQL为开发者提供了一组丰富的工具来管理 ...

  6. 浅析Postgres中的并发控制(Concurrency Control)与事务特性(上)(转)

    这篇博客将MVCC讲的很透彻,以前自己懂了,很难给别人讲出来,但是这篇文章给的例子就让人很容易的复述出来,因此想记录一下,转载给更多的人 转自:https://www.cnblogs.com/flyi ...

  7. linux tableau server 连接 presto

    记录一下这个弄个好久的难题 linux tableau server 版本  tableau-server-2018-2-0.x86_64.rpm 安装过程 我参照了这儿仁兄   http://ju. ...

  8. Apache ShardingSphere 5.1.2 发布|全新驱动 API + 云原生部署,打造高性能数据网关

    在 Apache ShardingSphere 5.1.1 发布后,ShardingSphere 合并了来自全球的团队或个人的累计 1028 个 PR,为大家带来 5.1.2 新版本.该版本在功能.性 ...

  9. oracle和postgresql 递归查询父子关系记录语法区别

    oracle: 一.数据 db数据字段如下: task_id             task_name         t.parent_task_id       *** ***          ...

随机推荐

  1. HTTP协议简要介绍

    1. 网络基础 TCP/IP 通常使用的网络是在TCP/IP协议簇基础上运作的. HTTP属于它内部的一个子集. TCP/IP分为4个层次, 应用层, 传输层, 网络层, 链路层. (Applicat ...

  2. oradebug工具使用2(转载)

    oradebug的前身是在ORACLE 7时的ORADBX,它可以启动用停止跟踪任何会话,dump SGA和其它内存结构,唤醒ORACLE进程,如SMON.PMON进程,也可以通过进程号使进程挂起和恢 ...

  3. go——函数

    1.定义 函数是结构化编程的最小单元模式.它将复杂的算法过程分解为若干个较小任务,隐藏相关细节,使程序结构更加清晰,易于维护.函数被设计成相对独立,通过接收输入参数完成一段算法指令,输出或存储相关结果 ...

  4. HDU - 6393 Traffic Network in Numazu (LCA+RMQ+树状数组)

    这道题相当于将这两题结合: http://poj.org/problem?id=2763 http://codeforces.com/gym/101808/problem/K 题意:有N各点N条边的带 ...

  5. 微信小程序:其中wxml和wxss的样式说明

    微信小程序:其中wxml和wxss的样式说明 一.简介 对于css不熟悉的Android程序员来说,开发微信小程序面临的一个比较困难的问题就是界面的排版了.微信小程序的排版就跟wxml和wxss有关了 ...

  6. ubuntu 致命错误: zlib.h:没有那个文件或目录【转】

    本文转载自:https://blog.csdn.net/u013359794/article/details/44922685?locationnum=15&fps=1 编译时,出现错误,提示 ...

  7. MongoDB快速入门(十三)- 聚合count、distinct和group

    1. count:     --在空集合中,count返回的数量为0.     > db.test.count()    0    --测试插入一个文档后count的返回值.    > d ...

  8. kafka入门使用

    kafka版本0.11.0.1以上自带zookeeper,必须要求环境中有jdk,解压后进入目录 1.在kafka解压目录下下有一个config的文件夹,里面放置的是我们的配置文件 consumer. ...

  9. how to get a controller instance in another controller

    https://stackoverflow.com/questions/16870413/how-to-call-another-controller-action-from-a-controller ...

  10. idea绿色版+谷歌浏览器绿色版——设置打开jsp文件

    首先我们的工具有 1.idea绿色版 2.Chrome绿色版 3.JavaJDK 4.Tomcat绿色版 文件放在那里都可以 1.idea设置默认打开Chrome 2.idea设置选择Tomcat和J ...