Inventory Database Structure

Legacy vs. MSI

Magento 2 has two inventory systems: Legacy (cataloginventory_*) and MSI (inventory_*).

Key Relationships

Inventory Tables Relationships

Note: This is a simplified diagram showing the main relationships.

Legacy Inventory Tables

cataloginventory_stock

Defines inventory stocks (legacy).

ColumnTypeDescription
stock_idsmallintPrimary key
website_idsmallintWebsite ID

Multi-Source Inventory (MSI) Tables

inventory_source

Defines inventory sources.

ColumnTypeDescription
source_codevarcharPrimary key
namevarcharSource name

Data Analysis Tips

  • Use MSI tables for Magento 2.3+ for accurate stock levels
  • Sum quantities across sources for total availability