Twitter/X

13,159 database errors occurred in 24 hours; 88% traced to one query caused by a…

Brief

@code_rams (Day 20 of 100 toward a $2k MRR target) traced 13,159 DB errors in 24 hours to a single misused flag that removed a batch cap, rebuilt the query on a Postgres clone (25,688ms → 202ms) and reduced prod latency to 0.74s for the heaviest account. They also found Airtable/Miro crons never scheduled, causing a 17‑month silent sync backlog (one customer 5,160 saved posts; oldest stuck row Feb 2025); two new subs raised MRR from $211.50 to $235.50.

Why it matters

13,159 database errors occurred in 24 hours; 88% traced to one query caused by a faulty flag: let isNoLimit = trial_status ? true : ... which removed a batch cap and caused the query to load entire saved-post libraries to return 20 rows twice every five minutes. Rebuilding on a Postgres clone cut latency from 25,688ms to 202ms; production for the heaviest account measured 0.74s after indexing and function runs.

Key details

  • Airtable and Miro sync crons were never scheduled (cron config only had Notion and Sheets), producing a 17-month silent sync backlog: one paying customer has 5,160 saved posts but only 20 ever reached Airtable, with the oldest stuck row from February 2025. Adding the two crons found the write path still broken (identified, not fixed).
  • Business impact: Day 20 of 100 toward a $2k MRR goal; current MRR $235.50 (up $24 from $211.50) after two new subscriptions landed during the incident.
Source evidence

Day 20 of 100, taking LinkedMash to $2k MRR. Current: $235.50 (+$24).

13,159 database errors in 24 hours.
88% of them were one query.

Chiti traced it to a single line:

let isNoLimit = trial_status ? true : ...

That flag is a batch cap, not an entitlement. Every trial account silently
removed the cap, so the query loaded an entire saved-post library to return
20 rows. Twice every five minutes.

Rebuilt it on a throwaway Postgres clone before going near production:

25,688ms to 202ms
identical rows out, checked both directions

Ran the index and the function on production myself. Measured the heaviest
account again: 0.74s.

The leftover backlog still did not drain. So we kept pulling.

Airtable and Miro sync were never scheduled. Not once. The cron config only
ever had Notion and Sheets.

One paying customer has 5,160 saved posts. 20 of them had ever reached their
Airtable. The oldest stuck row is from February 2025.

Added the two crons. Still zero syncing, so the write path is broken as well.
Found, not fixed.

Two new subs landed while we were in there. $211.50 to $235.50.

The query I fixed was loud. The one that never ran was silent for 17 months.