Skip to content

InnoDB Disk Structures

Yaotian Feng edited this page Jul 30, 2024 · 1 revision

InnoDB File Structure

MySQL/InnoDB typically uses the following files to store data:

  • Tablespace files (.ibd): These contain the actual table data, indexes, and other related information.
  • System tablespace (ibdata1): Stores the data dictionary, undo logs, and (optionally) table data.
  • Redo log files (ib_logfile0, ib_logfile1): Used for crash recovery and maintaining ACID properties.

Understanding InnoDB Tablespaces

Tablespaces are logical containers in InnoDB that store tables, indexes, and other data structures. They play a crucial role in how InnoDB manages data on disk.

Types of Tablespaces

  • System Tablespace
    • Traditionally, this was the primary tablespace (ibdata1 file).
    • It contains the data dictionary, undo logs, and potentially table data.
    • In older configurations, all InnoDB tables were stored here.
  • File-Per-Table Tablespaces
    • Each table has its own .ibd file.
    • Introduced to provide better data management and reclamation of space.

Page Structure

InnoDB organizes data in pages, which are typically 16 KB in size. These pages can be of different types:

  • Index pages
  • Data pages
  • Undo log pages
  • System pages
Clone this wiki locally