Skip to content

Instantly share code, notes, and snippets.

@ideawu
Created December 12, 2020 03:16
Show Gist options
  • Save ideawu/96383fa339a877836380ecbfea7315ee to your computer and use it in GitHub Desktop.
Save ideawu/96383fa339a877836380ecbfea7315ee to your computer and use it in GitHub Desktop.
数据库系统中的日志

日志(LOG, Journal)是持久化的核心, 是基础, 是必须.

根据日志的用途, 可以分成两类:

  1. Write Ahead Log, 将数据持久化在日志中, 日志持久化, 即代表数据持久化. 日志持久化之后, 后期再将数据转存到它们应该放的地方.
  2. Write Behind Log, Commit Log, 先将数据直接写到它们应该放的地方, 然后通过日志来确认.

WAL 在理想情况下, 单次写的延迟较小, 但有写放大问题, 因为必须有"转存"步骤.

WBL 单次写延迟大, 因为每一次写请求涉及两次持久化, 但没有写放大问题.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment