Vinyl Bin

Database Internals 01 Introduction and Overview

Every database solve some problem, every problem cannot be solved by single database.

Some major grouping

Common DBMS Architecture

1. Transport

2. Query processor

3. Query Parser

4. Query Optimizer

5. Execution Engine

6. Storage Engine

In-memory vs Disk Based DBMS

In-memory

Disk Based

Durability in Memory Databases

Gains of Memory Databases

Column vs Row Orientated DBMS

This division is mostly based on the read path or the access pattern.

Row Orientated

Column Orientated

Wide Column Store

{
  "DEL|BOM|2026-12-01|BUSINESS|2A0C0I": {
    "fare": {
      "0|290000|BA178": { "airline": "BA", "depart": "19:30" },
      "0|310000|DL1":   { "airline": "DL", "depart": "21:00" },
      "1|240000|IB6252": { "airline": "IB", "depart": "17:10" }
    },
    "meta": { "fetched_at": "2026-10-21T10:15:00Z", "provider": "TJ" }
  },
  "DEL|BBI|2026-12-01|ECONOMY|1A0C0I": {
    "fare": {
      "0|45000|DL1":    { "airline": "DL", "depart": "21:00" },
      "0|52000|BA178":  { "airline": "BA", "depart": "19:30" }
    }
  }
}

The storing happens with

Column Family "fare"
row key          | column            | value
DEL|BBI|...      | 0|45000|DL1       | {...}
DEL|BBI|...      | 0|52000|BA178     | {...}
DEL|BOM|...      | 0|290000|BA178    | {...}

Column Family "meta"
row key          | column            | value
DEL|BOM|...      | fetched_at        | 2026-10-21T10:15:00Z
DEL|BOM|...      | provider          | TJ

Data files and Index Files

Quick access is the primary objective of any database. This makes how the data being organised very valuable. Using the file system of an OS is not efficient as there are many operations which maximised:

Data Files

DBMS store data records in files where each file usually represents a table know as data files.

Index Files

As the data grow, and for effective access index files are present which allow us to effectively locate data records without scanning the entire file.

Clustered vs Non-clustered

Primary Index as an Indirection

When fetching by secondary indexes there are 2 ways to do it

Hybrid approach is always there, where secondary index will have both the data file offsets and primary keys. If the data offset is not valid then only do an extra lookup via primary index and then updating the offset stored in the secondary index.

Buffering, Immutability, and Ordering

All the storage structure have these 3 common variables