Urgent.News

What's breaking now, across thousands of outlets.

Tech

Serialization and Deserialization in Database Engines: How Data Becomes Bytes

When building a database engine from scratch, one of the most important concepts you need to understand is serialization and deserialization . You might be wondering: How does a database store data on disk? How does it convert a C structure into bytes? How does it read those bytes back into memory? How can we save records and retrieve them after restarting the database? These questions lead us to…

In the realm of database engines, two crucial processes stand out: serialization and deserialization. These techniques facilitate the conversion of data structures into a format suitable for storage or transmission, and vice versa. To grasp their significance, let us delve into their workings and applications.

Serialization is the art of transforming data structures residing in memory into a byte sequence that can be stored or transmitted. Consider a C structure representing a user:

typedef struct {

uint32_t id;

char name[32];

uint32_t age;

} User;

Assuming we instantiate a user:

User user = { .id = 1, .name = "Farhad", .age = 22 };

This structure exists in the RAM. However, a database engine requires storing it on disk to ensure its persistence even after the program exits. Serialization facilitates this by converting the structure into a sequence of bytes that can be written to a file. In essence: C Structure → Serialization → Bytes → Disk.

Deserialization, conversely, is the inverse process. It takes the previously serialized bytes and reassembles the original data structure in memory. Suppose our database contains a serialized user record. Upon retrieval, the database reads the bytes from disk and reconstructs the User structure. The process unfolds as follows:

Disk → Bytes → Deserialization → C Structure

Now, we can access the original user information:

printf("ID: %d\n", user.id);

printf("Name: %s\n", user.name);

printf("Age: %d\n", user.age);

The seamless interplay between serialization and deserialization enables persistent data storage. Database engines rely on these processes to store vast amounts of data on disk, ensuring data integrity and accessibility even when the program is terminated or the computer shuts down.

The indispensability of serialization and deserialization becomes evident when considering a database storing thousands of user records, each comprising an ID, name, and age. To maintain data persistence, the database must convert these records into byte sequences, write them to disk, and recreate them when required. Serialization and deserialization serve as the backbone for this essential functionality across various database components, including database records, pages, write-ahead logs (WAL), index structures, backup files, network communication, and database replication.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Stop Exporting One Square Image for Every Platform in 2026

The fastest workflow in social media design is one master file. Export a single 1080×1080 square, upload it everywhere, let each platform do the rest.

  • Exporting one 1080x1080 square image for all platforms in 2026 simplifies workflow.
  • Single image maintains control over cropping, avoiding distortion.
  • Tailored exact sizes for each platform prevent cropping or padding issues.

How I Built a Zero-Browser B2B Company Enrichment Pipeline in n8n (Replacing 5 Chained APIs)sda

If you build outbound pipelines in n8n , Clay , or Make , you probably know the pain of enriching a list of company domains: Call one tool for emails & socials Call another for tech stack detection…

  • Zero-browser HTTP-based enrichment pipeline built in n8n
  • Parallel fetching of homepage HTML, DNS records, and TLS certificates
  • Automatic discovery of internal pages for tech stack analysis

Making a booking page installable: tenant-aware PWA with vite-plugin-pwa

A PWA is usually explained with one manifest and one service worker. That's fine until you serve many tenants from one installation — then every tenant needs its own app identity, its own icon label…

  • Each tenant requires its own app identity, icon, and start URL to avoid conflicts.
  • Per-tenant PWAs implemented using Vite 6, vite-plugin-pwa, and Workbox generateSW.
  • Stable manifest id prevents multiple installations with same shop appearing on home screen.

More from Thursday 19 November →