Skip to main content
Metrics type: Key MetricsCategory: Cross-Platform: Revenue at Risk

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.

Calculation

The card runs two counts and compares them per SKU. On the MySQL side it reads the live inventory table, for example:
On the ecom side it reads the connector’s published inventory snapshot (the quantity the storefront would show a shopper). It then joins the two sets on SKU and counts the rows where the quantities disagree beyond a tolerance:
The default tolerance is zero (exact match), because for most catalogues the database and storefront should agree to the unit. A non-zero tolerance can be configured where the platform applies a safety buffer (for example, reserving stock for in-flight carts). Two edge categories also count as drift: a SKU present in MySQL but missing from the ecom feed (failed to publish) and a SKU present in the ecom feed but missing from MySQL (orphaned listing, often a deleted product still live on the storefront). Both are surfaced because both mislead shoppers. The real-time MySQL read against a 24-hour ecom baseline is intentional: the database changes continuously as orders deduct stock, while the storefront catalogue is republished on a slower cadence. The card measures the gap between “what the database knows right now” and “what shoppers can currently see”, which is exactly the window in which overselling happens.

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: The 19 drifting SKUs are the high-velocity lines that sold through the morning. The database correctly shows them low or at zero; the storefront still shows the 09:00 quantities. The alert (>0 SKUs drifting) fired at 09:32 on the first divergence.
The platform team’s response: fix the token, force a sync, and confirm the card returns to 0. The deeper fix is to make the scheduler fail loudly (correct exit-code handling) and to add this card as the canary, because the scheduler lied but the drift count did not. Three takeaways:
  1. 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.
  2. 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.
  3. 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

Reconciling against the source

Where to look in MySQL directly:
SELECT COUNT(*) FROM inventory_stock WHERE qty > 0; for the count of in-stock SKUs in the database (substitute your real inventory table, for example cataloginventory_stock_item on 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.
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: Cross-connector reconciliation:

Known limitations / FAQs

The card shows drift but my sync job reports success. Which do I trust? Trust the card. Sync jobs frequently report success while doing nothing: wrong exit-code handling, a swallowed exception, a partial batch that committed the count but not the rows. This card measures the outcome (do the numbers match?) rather than the process (did the job run?). When the two disagree, the outcome is the truth and the job’s status is the bug. A small drift appears every 30 minutes then clears. Is that a problem? Probably not, that is sync cadence lag. Between two scheduled sync runs the database moves as orders deduct stock, but the storefront only updates on the next run. The drift you should worry about is the kind that does not clear: it grows or persists across multiple sync cycles, which means the pipeline has actually broken rather than simply being mid-cycle. How do I tell overselling drift from phantom-out-of-stock drift? Drill into the flagged SKUs. If MySQL quantity is lower than the storefront quantity, you are at risk of overselling (shoppers can buy stock that is gone). If MySQL is higher than the storefront, you have phantom out-of-stocks (real stock hidden from shoppers, lost sales). Both count as drift; the direction tells you which revenue risk you are carrying right now. Could replication lag make this card cry wolf? Yes, if the ecom feed reads a read-replica that is behind the primary. The storefront then reflects a past database state and the card reports drift that is really lag. Pair with Replication Lag (Seconds_Behind_Source): if the drift clears exactly when the lag clears, it was a replication artefact. If it persists with zero lag, it is a genuine sync failure. The durable fix is to reconcile against the primary. My platform reserves stock for active carts, so the numbers never match exactly. Set a tolerance equal to your reservation buffer, or point the card at the post-reservation “available to sell” figure rather than the raw row count. A fixed reservation policy produces a predictable, constant offset; configure for it once and genuine drift stands out clearly above the baseline. Does this catch products that exist on the storefront but were deleted in the database? Yes. A SKU present in the ecom feed but missing from MySQL counts as drift (an orphaned listing). These are shoppers being shown products that no longer exist in the system of record, which usually ends in a failed order. Likewise a SKU in MySQL but missing from the feed (failed to publish) is counted, because it is sellable stock the storefront is hiding.

Tracked live in Vortex IQ Nerve Centre

MySQL Inventory Rows vs Ecom Inventory Count is one of hundreds of KPI pulses Vortex IQ tracks across MySQL and 70+ other ecommerce connectors. Nerve Centre runs the detection layer; Vortex Mind investigates the cause when something moves; Ask Viq lets you interrogate any number in plain English. Start for free or book a demo to see this metric running on your own data.