AIFeed

The Life of a Database Row: What Really Happens Behind the Scenes

Summary

An INSERT, UPDATE, or DELETE might look like a small operation when looking at it from the outside. You add a row, change some values, or remove something that is no longer needed. But inside the database, such a request can involve memory, transaction logs, indexes, older row versions, and background cleanup. Also, other machines might be involved. It’s the responsibility of the database to make these pieces work together while letting you run concurrent queries and dealing with crashes. This is why a committed row can still be waiting for its data page to reach disk, and a deleted row might continue to take up storage space. In this article, we’ll look at the life of a row in the database with respect to these operations. Here’s what we’ll cover: What is a row How insert operations work The role of WAL How update operations work How delete operations work Vacuum and compaction How replication and backup work How database commits generate work What is a Row? Read more

Original text(via ByteByteGo)

An INSERT, UPDATE, or DELETE might look like a small operation when looking at it from the outside. You add a row, change some values, or remove something that is no longer needed. But inside the database, such a request can involve memory, transaction logs, indexes, older row versions, and background cleanup. Also, other machines might be involved.

It’s the responsibility of the database to make these pieces work together while letting you run concurrent queries and dealing with crashes. This is why a committed row can still be waiting for its data page to reach disk, and a deleted row might continue to take up storage space.

In this article, we’ll look at the life of a row in the database with respect to these operations. Here’s what we’ll cover:

  • What is a row
  • How insert operations work
  • The role of WAL
  • How update operations work
  • How delete operations work
  • Vacuum and compaction
  • How replication and backup work
  • How database commits generate work

What is a Row?

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 ↗