October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How Databases Store Data: From Rows to Pages, Indexes, and Logs

Database engines organize tables into pages stored in files or tablespaces. Learn how rows, indexes, memory caches, and transaction logs work, with examples from PostgreSQL, SQLite, and InnoDB.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A database turns logical tables into structures stored in files or tablespaces, usually organized into fixed-size pages. Rows and indexes live inside those pages; memory caches speed access, while transaction logs help the engine recover after interruptions. The exact arrangement depends on the database engine—there is no single storage format shared by every database.

What happens to data after you insert it?

The application sends a command to the database engine. The engine checks the operation and its transaction, changes the relevant data structures, and records information needed to satisfy its durability and recovery rules. Changed pages are written to persistent storage according to the engine’s design and configuration. A successful commit does not necessarily mean every changed page has already been copied into the main data file.

As an Amazon Associate I earn from qualifying purchases.

Think of a table as an inventory and its pages as labeled bins. A page contains information the engine needs to interpret it, plus space for records or index entries. An index is like an organized map that helps narrow the search to relevant records. The engine may keep frequently used pages in memory and use a log to restore a consistent state after a failure. This is a mental model, not a universal physical layout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What are database pages, rows, and indexes?

Pages hold structured data

A page is a unit the engine manages when reading and writing database contents. It is not necessarily a flat block of text: it can include a header, identifiers or pointers, free space, and stored items. PostgreSQL’s documentation describes a page with a 24-byte header, item identifiers, free space, row items, and—in some cases—special space for index data. PostgreSQL’s usual page size is 8 kB, but the size can differ if selected when the server is compiled. These are PostgreSQL-specific details, not requirements of SQL databases generally. PostgreSQL 17: Database Page Layout.

#1 Best Overall
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Rows are records, not always simple text strings

A table row is represented in the engine’s own on-disk format. In PostgreSQL, for example, a row has a fixed-size header followed by optional metadata and user data. The engine uses that structure to interpret values and manage storage; it is not simply saving each row as a line of readable text.

Indexes are extra structures for finding records

An index organizes lookup information so the engine can avoid examining every row in some queries. SQLite uses B-trees for its table and index structures, and InnoDB uses B-trees for indexes other than spatial indexes, which use R-trees. Indexes require storage and must be maintained as data changes. A query may not use an index, and using one does not guarantee a faster result: the query plan and workload matter.

How do databases read and write data?

On a write

  1. The engine validates the operation and its transaction.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  2. It changes relevant in-memory structures and records information in its logging mechanism as required by its recovery and durability rules.

    Rank #2
    Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
    • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
    • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
    • To get set up, connect the portable hard drive to a computer for automatic recognition software required
    • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
    • The available storage capacity may vary.
  3. It writes changed pages to persistent files or tablespaces according to its design and configuration.

  4. If the system stops unexpectedly, recovery uses the engine’s logs and transaction rules to restore a consistent state.

The details—including what has reached persistent storage when a client receives success—depend on the engine and its configuration. A log and the main data files have different roles; they are not interchangeable copies of the same thing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On a read

The engine considers the query plan and available indexes to identify relevant records. If the needed pages are already cached in memory, it may avoid a storage read; otherwise, it reads them from persistent storage. The cache changes where a page is served from, not the logical contents of the query.

Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

How do PostgreSQL, SQLite, and InnoDB differ?

These examples show common concepts in three specific implementations. Their page sizes and file arrangements are not universal database defaults.

Engine and documentation Physical organization Page details Logging and recovery
PostgreSQL 17 Tables and indexes are stored as arrays of fixed-size pages. Usual page size is 8 kB; it may differ based on the server’s compile-time choice. A page header is 24 bytes. The page-layout source cited here does not establish a specific transaction-log workflow; consult PostgreSQL’s recovery documentation for those details.
SQLite, file format used since SQLite 3.0.0 The complete database state is usually in a main database file; journal files may also be involved. Page sizes range from 512 bytes to 65,536 bytes. Depending on journal mode, transactions use a rollback journal or a write-ahead log (WAL). In WAL mode, frames hold revised pages, a commit marker identifies a committed transaction, and checkpointing transfers WAL content to the main database file.
InnoDB, MySQL 26.7 Reference Manual Data is stored in tablespaces made up of pages. Default page size is 16 KB and is configurable when initializing the instance. Redo records changes and helps correct data files after an unexpected shutdown; recovery applies redo and rolls back incomplete transactions.

SQLite: commonly one main file, sometimes more files in use

SQLite’s documentation says, “The complete state of an SQLite database is usually contained in a single file on disk called the "main database file".” The word “usually” matters: transaction state may also involve a rollback journal or a WAL file, depending on journal mode. SQLite: Database File Format.

SQLite organizes that file into pages, with table and index structures built using B-trees. The documented page-size range is 512 to 65,536 bytes; the file-format documentation covers the format used since SQLite 3.0.0. SQLite: Architecture.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

InnoDB: tablespaces, buffer pool, and redo

InnoDB stores data in tablespaces made up of pages. Its documented default page size is 16 KB, configurable when the instance is initialized. It uses B-trees for indexes except spatial indexes, which use R-trees. Its buffer pool caches data and index pages, while redo supports recovery after an unexpected shutdown. Recovery applies redo and rolls back incomplete transactions. These details are from Oracle’s MySQL 26.7 Reference Manual. MySQL 26.7: InnoDB Physical Structure MySQL 26.7: InnoDB Buffer Pool MySQL 26.7: InnoDB Recovery.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue
  • Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Why keep pages in memory and changes in logs?

Reading from memory can avoid repeated storage access for frequently used pages. SQLite’s architecture describes a page cache; InnoDB’s buffer pool holds data and index pages. These caches help mediate database access to persistent storage, but they do not replace the persistent database files.

Logs serve recovery and transaction purposes. In SQLite WAL mode, revised pages are recorded in WAL frames and later transferred into the main file through checkpointing. In InnoDB, redo helps bring data files up to date after an unexpected shutdown, while incomplete transactions are rolled back. The mechanisms and guarantees depend on the engine and its configuration. SQLite: Write-Ahead Logging MySQL 26.7: InnoDB Recovery.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Where do very large values go?

A database may handle oversized fields differently from ordinary row data, for example by moving them to auxiliary storage or compressing them. PostgreSQL documents its TOAST mechanism for handling large values. The exact behavior is engine-specific, so a general explanation of pages and rows should not be taken to mean every value is stored inline in the same way. PostgreSQL 17: TOAST.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What does this mean for a database user?

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.