At a glance
A consistency check between the inventory stored in your MySQL database and the inventory the storefront platform reports. The card counts SKUs in the MySQL inventory table and compares them against the ecom connector’s published inventory count, then reports how many SKUs have drifted apart. Any non-zero drift means the source of truth and the shopper-facing catalogue disagree, which leads directly to overselling (selling stock you do not have) or phantom out-of-stocks (hiding stock you do have). Both cost money; the first costs trust and refunds, the second costs sales.
| What it tracks | The count of SKUs whose stock level in the MySQL inventory table does not match the same SKU’s published inventory in the linked ecom connector (Shopify, BigCommerce, Adobe Commerce). |
| Data source | MySQL side: a COUNT/SUM over the inventory table (typically cataloginventory_stock_item on Magento, a custom inventory/stock table, or the platform’s local mirror), read in real time. Ecom side: the connector’s published inventory count, refreshed on its standard cadence (24h baseline with real-time deltas). |
| Why it matters | The database is usually the system of record; the storefront is a cache of it. When they drift, shoppers buy stock that is not really there (oversell, refund, apology) or the store hides stock it actually has (lost sale). Drift is the silent failure mode of any inventory-sync pipeline. |
| Reading the value | A reading of 0 SKUs drifting is healthy. Any positive number is the count of SKUs to investigate. The card surfaces the count; drill into the linked sync logs to see which SKUs and by how much. |
| Time window | RT/24h: real-time database read reconciled against the 24-hour ecom inventory baseline. |
| Alert trigger | >0 SKUs drifting: any drift at all trips the card, because even one drifting high-velocity SKU can oversell quickly. |
| Roles | owner, operations, engineering |
Calculation
The card runs two counts and compares them per SKU. On the MySQL side it reads the live inventory table, for example:Worked example
A team runs the catalogue in MySQL and syncs inventory to the storefront every 30 minutes via a scheduled job. On 14 Apr 26 the sync job silently fails at 09:00 (an expired API token) but the scheduler keeps reporting “success” because it caught the wrong exit code. By 13:00 the card reads:| Metric | Value |
|---|---|
| SKUs in MySQL inventory table | 12,480 |
| SKUs in ecom published feed | 12,480 |
| SKUs with matching quantity | 12,461 |
| SKUs drifting | 19 |
>0 SKUs drifting) fired at 09:32 on the first divergence.
- The database is the truth; the storefront is a cache. When they disagree, trust the database and republish. The card tells you the cache is stale before shoppers do.
- Zero tolerance is the right default for inventory. A drift of one unit on a one-of-a-kind item is a guaranteed oversell. Only widen tolerance if the platform deliberately reserves a safety buffer.
- A “successful” sync job is not proof of correctness. Jobs can report success while doing nothing. This card measures the outcome (do the numbers match?) rather than the process (did the job run?), which is why it catches silent failures.
Sibling cards
| Card | Why pair it with Inventory Rows vs Ecom Count | What the combination tells you |
|---|---|---|
| MySQL QPS Spike vs Ecom Order Rate | The query-volume cross-channel peer. | A sync job hammering the database (QPS spike) with drift still present means the job is running but failing to write. |
| MySQL Pool Saturation vs Traffic Burst | Sync jobs compete for connections during peak. | Drift appearing during a burst can mean the sync job was starved of connections. |
| Replication Lag (Seconds_Behind_Source) | If the ecom feed reads a replica, lag causes apparent drift. | Drift that clears when lag clears is a replication artefact, not a real sync failure. |
| Replication Thread Health (IO/SQL) | A stopped replica thread freezes the inventory a reader sees. | Broken replication plus drift means the storefront is reading a stale frozen replica. |
| Query Error Rate % | Failed writes during sync leave inventory unchanged. | An error-rate spike during the sync window explains why the database did not update. |
| Top 10 Slowest Queries (digest) | A slow inventory-update query can time out mid-sync. | A slow inventory UPDATE in the top-10 list points at the drift cause. |
| MySQL Health Score | The composite that summarises overall instance health. | Drift with a healthy score means the database is fine and the sync pipeline is the fault. |
Reconciling against the source
Where to look in MySQL directly:On managed services the table-level read is identical; the database engine does not change the calculation. What changes is where the ecom feed reads from: if the storefront reads a read-replica, confirm the replica is current (see the replication cards below) before treating drift as a sync failure. Why our number may legitimately differ from a manual diff:SELECT COUNT(*) FROM inventory_stock WHERE qty > 0;for the count of in-stock SKUs in the database (substitute your real inventory table, for examplecataloginventory_stock_itemon Magento).SELECT sku, qty FROM inventory_stock WHERE sku IN (...);to inspect the specific drifting SKUs the card flags. Cross-check against the storefront’s own inventory export or API: pull the published quantity for the same SKUs and diff. The numbers should match unit for unit.
| Reason | Direction | Why |
|---|---|---|
| In-flight carts / reservations | Apparent drift | If the platform reserves stock for active carts, the storefront-visible quantity is lower than the raw database row. Configure the tolerance to account for the reservation buffer. |
| Sync cadence lag | Transient drift | Between two sync runs the database moves but the storefront does not; a small drift is expected and clears on the next sync. Persistent drift across multiple cycles is the real alert. |
| Replica read lag | Apparent drift | If the ecom feed reads a lagging replica, the storefront reflects a past database state. Reconcile against the primary, not the replica. |
| SKU mapping | Phantom drift | A SKU naming mismatch between systems (case, prefix, leading zeros) makes matching rows look like drift. The card normalises common cases; unusual mappings may need configuration. |
| Card | Expected relationship | What causes divergence |
|---|---|---|
shopify.inventory / linked ecom connector | The ecom inventory count should equal the MySQL count to within the reservation tolerance. | A persistent gap is a sync-pipeline failure; a transient gap is cadence lag. |
mysql_replication_lag_seconds | If reads come from a replica, drift should track lag. | Drift that does not clear when lag clears is a genuine sync failure, not replication. |