Newshot
Account

The Hidden Work Behind Every Database Request

Summary

Mostly, an application’s storage system has to do work only when users make requests to that application. However, there’s a difference between the work requested and the work that the storage system has to perform. A storage system does extra work as well, which is equally important. It can help you find data quickly, recover data after a crash, or support concurrent transactions. But this extra work also has a cost. For example, the request might involve reading a small record, but it can require fetching many blocks of data. Or when the user requests an update to some value, it can trigger multiple writes in the storage system. Also, if you want to keep the dataset highly available, it might require much more space than the actual size of the dataset. Read amplification, write amplification, and space amplification show the differences between logical work and physical cost. In this article, we’re going to look at these differences in detail. Here’s what we will cover: What is logic…

Original text(via ByteByteGo)

Mostly, an application’s storage system has to do work only when users make requests to that application.

However, there’s a difference between the work requested and the work that the storage system has to perform. A storage system does extra work as well, which is equally important. It can help you find data quickly, recover data after a crash, or support concurrent transactions. But this extra work also has a cost. For example, the request might involve reading a small record, but it can require fetching many blocks of data. Or when the user requests an update to some value, it can trigger multiple writes in the storage system. Also, if you want to keep the dataset highly available, it might require much more space than the actual size of the dataset.

Read amplification, write amplification, and space amplification show the differences between logical work and physical cost. In this article, we’re going to look at these differences in detail. Here’s what we will cover:

  • What is logical work and physical work in a database
  • Read amplification
  • Write amplification
  • Space amplification
  • The amplifications with B-trees
  • The amplifications with LSM trees
  • How indexes and filters use space to avoid reads
  • How compression helps improve amplifications
  • The role of caching
  • The impact of amplification

Logical Work and Physical Work

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by ByteByteGo
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗