Guides · Broken records Find broken records in your app database before they cost you.
Dashboards show totals. Money leaks in single records that break a rule across tables. Numling’s weekly review reads your app database, finds those records and files them in your Review inbox with what each one costs.
Cash on delivery not collected for Surat’s sellers
The rule it breaks
A delivered cash-on-delivery order has a successful payment.
What it found
31 orders from 4 of Surat’s sellers, delivered since 8 Oct, have no successful payment. Prepaid orders from the same sellers are paid.
For example
18204, 18377, 18902, 19011, 19146
The money is in a few records.
A merchant’s system marked 402 payments as failed. 74 had been paid, and their orders were cancelled anyway.
402 payments marked failed
328 others74 paid, order cancelled
₹18.5 lakh of real orders, lost in 74 records
Connect your app database, read-only
Postgres, MySQL or MongoDB. Numling’s queries only read, with a timeout, and refuse anything that writes.
The weekly review runs on its own
Once you confirm an area in setup, such as orders and money, Numling reviews it every week. Quill learns how your tables join and what each flow should do, from placed to paid to delivered, and looks for records that break it.
Each finding shows its proof
The rule it breaks, what it found, example records, what it costs and the query behind it. Investigate it with Quill, Watch it with an alert, or mark it Not a problem.
It re-checks every day, without a model
A finding’s query reruns daily. It closes on its own when the records are fixed, and reopens if the problem comes back within 30 days.
5 rules app databases break.
- Delivered on cash, never collected
- The courier marked it delivered and no payment was ever recorded. The finding above.
- Paid but marked failed
- The gateway took the money and the order says failed or cancelled. 74 of Cashfree’s 402 payments broke this rule.
- Paid but never shipped
- A successful prepaid payment, and the order still not shipped 2 days later.
- Returned but counted as sold
- Often after a status is renamed, say RTO to RETURNED_TO_ORIGIN, while old queries count only the old name. On ClickPost’s network, 37.5% of cash-on-delivery orders ended as returned to origin, against 5.3% of prepaid.
- Times that can’t happen
- An order delivered before it was placed: a clock or an import gone wrong, and every duration worked out from it is off.
Doing it by hand
Rule 1 as a query. It returns the records themselves, not a count. Run it daily, and treat the problem as fixed only when it comes back empty.
select o.id, s.city, o.seller_id,
o.goods_value / 100.0 as goods, o.delivered_at
from orders o
join sellers s on s.id = o.seller_id
join buyers b on b.id = o.buyer_id
where o.payment_mode = 'cod'
and o.status = 'delivered'
and o.delivered_at < now() - interval '1 day'
and o.deleted_at is null
and o.goods_value > 0
and not s.is_internal
and b.email not like '%@shop-internal.test'
and not exists (select 1 from payments p
where p.order_id = o.id
and p.status = 'success')
order by o.delivered_at;Other guides.
- A weekly metrics report in SlackYour Monday numbers in Slack, built from your database, and held when a number fails a check.Read the guide →
- Anomaly detection for startup metricsAn alert when a number falls under a usual day, replayed on your last 8 weeks before it’s saved.Read the guide →
- Real-time anomaly alerts in Slack from Postgres or MySQLCatch hourly payment or signup drops with an 8-week replay and copy-paste Postgres & MySQL SQL.Read the guide →
- Safe read-only AI SQL with PII maskingLeast-privilege read-only roles across Postgres, Supabase, MySQL and warehouses, plus automatic PII masking.Read the guide →
- Move Metabase dashboards into automated Slack reportsImport Metabase dashboards via API key and replace static PNGs with checked Slack reports.Read the guide →
FAQ
Questions people ask.
How do I find cash-on-delivery orders that were never paid?
Look for delivered cash-on-delivery orders with no successful payment a day after delivery, leaving out test buyers, internal sellers and deleted orders. Numling’s review finds this without being told the rule; the query on this page does it by hand.
Isn’t this what dbt tests or Monte Carlo do?
They check that data arrived and has the right shape, in a data team’s pipeline, and each rule is one someone wrote. The review looks for rules across your app’s tables that nobody has written yet.
Is it safe to run on the production database?
Numling’s queries only read, with a timeout, and refuse anything that writes. Point it at a replica if you have one.
How much does a returned cash-on-delivery order cost?
Razorpay puts it at about ₹561 per returned order, on average. That’s why returns still counted as sales are worth checking early.
See the records worth a look in your own database.
Connect Postgres, MySQL or MongoDB, confirm what to review, and it runs every week.