WAL用于什么? [英] What is WAL used for?

查看:68
本文介绍了WAL用于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想弄清楚这个板上使用的术语和

想知道什么是WAL以及它在Postgresql中扮演什么样的卷?


谢谢

I''m just trying to figure out the terminology that is used on this board and
wanted to know what is WAL and what roll does it play in Postgresql?

Thanks

推荐答案

WAL是预写日志记录。基本上,在数据库实际执行操作之前,它会在日志中写入它将要执行的操作。那么,它就是b $ b去做了。这可确保数据一致性。让我们说

计算机突然断电了。有几点可以发生:b
)在写入之前 - 在这种情况下,数据库可以正常使用或者

没有预先写入日志。


2)在写入期间 - 如果机器已通电则无需预先写入

在写入期间关闭,数据库无法知道写的是什么,或者写的是什么。与Postgres相比,这是另外两种可能性:


*在写入日志时发生断电 - 在此

的情况下,日志被回滚。数据库不受影响,因为数据

从未正确写入数据库。


*写入日志后写入电源时发生了断电

磁盘 - 在这种情况下,Postgres可以简单地从日志中读取应该写的

,并完成写入。


3)写完之后 - 这不会影响Postgres或者没有WAL的




另外,WAL增加了PostgreSQL''效率,因为它可以延迟

随机访问写入磁盘,并且只需对日志执行顺序写入

a。这减少了骗子正在进行的头部搜索量。

如果将WAL文件存储在不同的磁盘上,则可以获得更快的速度

优势。


Jon


2003年11月25日星期二,Relaxin写道:
WAL is write-ahead logging. Basically, before the database actually
performs an operation, it writes in a log what it''s about to do. Then, it
goes and does it. This ensures data consistency. Let''s say that the
computer was powered off suddenly. There are several points that could
happen:

1) before a write - in this case the database would be fine with or
without write-ahead logging.

2) during a write - without write-ahead logging, if the machine is powered
off during a write, the database has no way of knowing what remained to be
written, or what was being written. WIth Postgres, this is furthere
broken down into two possibilities:

* The power-off occurred while it was writing to the log - in this
case, the log is rolled back. The database is unaffected because the data
was never written to the database proper.

* The power-off occurred after writing to the log, while writing to
disk - in this case, Postgres can simply read from the log what was
supposed to be written, and complete the write.

3) after a write - again, this does not affect Postgres either with or
without WAL.

In addition, WAL increases PostgreSQL''s efficiency, because it can delay
random-access writes to disk, and just do sequential writes to the log for
a long time. This reduces the amount of head-seek the dissk are doing.
If you store your WAL files on a different disk, you get even more speed
advantages.

Jon

On Tue, 25 Nov 2003, Relaxin wrote:
我只是在尝试找出这个板子上使用的术语,
想知道什么是WAL以及它在Postgresql中起什么作用?

谢谢

- -------------------------(播出结束)-------------------- -------
提示7:别忘了增加你的可用空间地图设置
I''m just trying to figure out the terminology that is used on this board and
wanted to know what is WAL and what roll does it play in Postgresql?

Thanks

---------------------------(end of broadcast)---------------------------
TIP 7: don''t forget to increase your free space map settings



------------ ---------------(播出结束)---------------------------

提示9:如果您的

加入列的数据类型不匹配,计划员将忽略您选择索引扫描的愿望


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match


Jonathan,


你能否告诉我fsync = false的实际影响是什么?在同一个灾难性场景中的WAL和

数据库中?

Thierry Missimilly


Jonathan Bartlett写道:
Jonathan,

Could you tell me what is the real impact of "fsync=false" on the WAL and on the
database in the same catastrophic scenario ?

Thierry Missimilly

Jonathan Bartlett wrote:
WAL是预写日志记录。基本上,在数据库实际执行操作之前,它会在日志中写入它将要执行的操作。然后,它去做了。这可确保数据一致性。让我们说
电脑突然断电了。有几点可以发生:

1)在写入之前 - 在这种情况下,数据库可以正常使用或没有预先写入日志。

2)在写入期间 - 没有预先写入日志记录,如果在写入期间机器已关闭,则数据库无法知道要写入的内容,或者什么是正在写与Postgres一起,这可以分解为两种可能性:

*在写入日志时发生了断电 - 在这种情况下,日志被滚动背部。数据库不受影响,因为数据从未正确写入数据库。

*写入日志后,写入
磁盘时发生了断电 - 在此例如,Postgres可以简单地从日志中读取应该写的内容,并完成写入。

3)写完后再次,这不会影响Postgres或者<没有WAL。

此外,WAL增加了PostgreSQL的效率,因为它可以延迟对磁盘的随机访问写入,并且只是对日志进行顺序写入<很长一段时间。这减少了骗子正在进行的头部搜索量。
如果将WAL文件存储在不同的磁盘上,则可以获得更快的优势。

Jon

2003年11月25日星期二,Relaxin写道:
WAL is write-ahead logging. Basically, before the database actually
performs an operation, it writes in a log what it''s about to do. Then, it
goes and does it. This ensures data consistency. Let''s say that the
computer was powered off suddenly. There are several points that could
happen:

1) before a write - in this case the database would be fine with or
without write-ahead logging.

2) during a write - without write-ahead logging, if the machine is powered
off during a write, the database has no way of knowing what remained to be
written, or what was being written. WIth Postgres, this is furthere
broken down into two possibilities:

* The power-off occurred while it was writing to the log - in this
case, the log is rolled back. The database is unaffected because the data
was never written to the database proper.

* The power-off occurred after writing to the log, while writing to
disk - in this case, Postgres can simply read from the log what was
supposed to be written, and complete the write.

3) after a write - again, this does not affect Postgres either with or
without WAL.

In addition, WAL increases PostgreSQL''s efficiency, because it can delay
random-access writes to disk, and just do sequential writes to the log for
a long time. This reduces the amount of head-seek the dissk are doing.
If you store your WAL files on a different disk, you get even more speed
advantages.

Jon

On Tue, 25 Nov 2003, Relaxin wrote:
我只想弄清楚这个板上使用的术语和
想知道什么是WAL以及它在Postgresql中播放的是什么卷?

谢谢

------------------ ---------(播出结束)---------------------------
提示7:不要'不要忘记增加你的可用空间地图设置
I''m just trying to figure out the terminology that is used on this board and
wanted to know what is WAL and what roll does it play in Postgresql?

Thanks

---------------------------(end of broadcast)---------------------------
TIP 7: don''t forget to increase your free space map settings



---------------------------(广播结束)---------------------------
提示9:规划人员会忽略您选择索引扫描的愿望你的
加入列的数据类型不匹配



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match



------------------------ ---(播出结束)---------------------------

提示3:如果发布/阅读通过Usenet,请发送一个适当的ate

subscribe-nomail命令 ma ******* @ postgresql.org 这样你的

信息就可以干净地进入邮件列表


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly


>你能告诉我fsync = false的实际影响是什么吗?在同一个灾难性场景中的WAL和
> Could you tell me what is the real impact of "fsync=false" on the WAL and on the
数据库?


我不确定这一点,但我相信fsync = false会搞砸

整件事。关于WAL的好处是fsync不再像减速那么多,因为PG很少需要对

磁盘进行随机访问写入。


Jon

Thierry Missimilly

Jonathan Bartlett写道:
database in the same catastrophic scenario ?
I am not certain on this point, but I believe fsync=false messes up the
whole thing. The nice thing about WAL is that fsync is no longer as much
of a slowdown, because PG rarely has to do random-access writes to the
disk.

Jon

Thierry Missimilly

Jonathan Bartlett wrote:
WAL是预写日志记录。基本上,在数据库实际执行操作之前,它会在日志中写入它将要执行的操作。然后,它去做了。这可确保数据一致性。让我们说
电脑突然断电了。有几点可以发生:

1)在写入之前 - 在这种情况下,数据库可以正常使用或没有预先写入日志。

2)在写入期间 - 没有预先写入日志记录,如果在写入期间机器已关闭,则数据库无法知道要写入的内容,或者什么是正在写与Postgres一起,这可以分解为两种可能性:

*在写入日志时发生了断电 - 在这种情况下,日志被滚动背部。数据库不受影响,因为数据从未正确写入数据库。

*写入日志后,写入
磁盘时发生了断电 - 在此例如,Postgres可以简单地从日志中读取应该写的内容,并完成写入。

3)写完后再次,这不会影响Postgres或者<没有WAL。

此外,WAL增加了PostgreSQL的效率,因为它可以延迟对磁盘的随机访问写入,并且只是对日志进行顺序写入<很长一段时间。这减少了骗子正在进行的头部搜索量。
如果将WAL文件存储在不同的磁盘上,则可以获得更快的优势。

Jon

2003年11月25日星期二,Relaxin写道:
WAL is write-ahead logging. Basically, before the database actually
performs an operation, it writes in a log what it''s about to do. Then, it
goes and does it. This ensures data consistency. Let''s say that the
computer was powered off suddenly. There are several points that could
happen:

1) before a write - in this case the database would be fine with or
without write-ahead logging.

2) during a write - without write-ahead logging, if the machine is powered
off during a write, the database has no way of knowing what remained to be
written, or what was being written. WIth Postgres, this is furthere
broken down into two possibilities:

* The power-off occurred while it was writing to the log - in this
case, the log is rolled back. The database is unaffected because the data
was never written to the database proper.

* The power-off occurred after writing to the log, while writing to
disk - in this case, Postgres can simply read from the log what was
supposed to be written, and complete the write.

3) after a write - again, this does not affect Postgres either with or
without WAL.

In addition, WAL increases PostgreSQL''s efficiency, because it can delay
random-access writes to disk, and just do sequential writes to the log for
a long time. This reduces the amount of head-seek the dissk are doing.
If you store your WAL files on a different disk, you get even more speed
advantages.

Jon

On Tue, 25 Nov 2003, Relaxin wrote:
我只想弄清楚这个板上使用的术语和
想知道什么是WAL以及它在Postgresql中播放的是什么卷?

谢谢

------------------ ---------(播出结束)---------------------------
提示7:不要'不要忘记增加你的可用空间地图设置
I''m just trying to figure out the terminology that is used on this board and
wanted to know what is WAL and what roll does it play in Postgresql?

Thanks

---------------------------(end of broadcast)---------------------------
TIP 7: don''t forget to increase your free space map settings



---------------------------(广播结束)---------------------------
提示9:规划人员会忽略您选择索引扫描的愿望你的
加入列的数据类型不匹配



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match



-------------------- -------(播出结束)---------------------------

提示3:如果通过Usenet发布/阅读,请发送d适当的

subscribe-nomail命令 ma ******* @ postgresql.org 这样你的

消息就可以干净地传递到邮件列表


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly


这篇关于WAL用于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆