Inventory Database Structure
Legacy vs. MSI
Magento 2 has two inventory systems: Legacy (cataloginventory_*) and MSI (inventory_*).
Key Relationships
Note: This is a simplified diagram showing the main relationships.
Legacy Inventory Tables
cataloginventory_stock
Defines inventory stocks (legacy).
| Column | Type | Description | 
|---|---|---|
| stock_id | smallint | Primary key | 
| website_id | smallint | Website ID | 
Multi-Source Inventory (MSI) Tables
inventory_source
Defines inventory sources.
| Column | Type | Description | 
|---|---|---|
| source_code | varchar | Primary key | 
| name | varchar | Source name | 
Data Analysis Tips
- Use MSI tables for Magento 2.3+ for accurate stock levels
- Sum quantities across sources for total availability
