<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/n-1-batcher-deleted-cache-key-corruption-hits-19-invoices-dtc7qusy8" -->

---
title: N+1 batcher deleted, cache key corruption hits 19 invoices
description: A team deleted 412 lines of 'unused' batching code and watched p50 feed latency jump from 94ms to 910ms and query count explode from 4 to 180-240 per request —...
canonical: https://daily.dev/posts/n-1-batcher-deleted-cache-key-corruption-hits-19-invoices-dtc7qusy8
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: N+1 batcher deleted, cache key corruption hits 19 invoices | daily.dev
og:description: A team deleted 412 lines of 'unused' batching code and watched p50 feed latency jump from 94ms to 910ms and query count explode from 4 to 180-240 per request —...
og:url: https://daily.dev/posts/n-1-batcher-deleted-cache-key-corruption-hits-19-invoices-dtc7qusy8
og:image: https://api.daily.dev/og/posts/DTc7qusY8.png
og:image:alt: N+1 batcher deleted, cache key corruption hits 19 invoices
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# N+1 batcher deleted, cache key corruption hits 19 invoices

**[Databases Digest](https://daily.dev/sources/databases_digest)** · 5 min read · 0 upvotes · 0 comments

## Summary

A team deleted 412 lines of 'unused' batching code and watched p50 feed latency jump from 94ms to 910ms and query count explode from 4 to 180-240 per request — a clean case study in why I/O coalescers need tests, not just comments. Separately, a Redis cache key missing three dimensions (price book version, currency, actor role) silently served wrong data across contracts for 11 days, producing 64 bad quotes and 19 converted invoices. MySQL 9.7 LTS lands with 8 previously enterprise-only features now in Community Edition. Hugging Face's Hub architecture talk is worth reading if you're thinking about MongoDB at scale.

## Content

**TLDR:** A team deleted 412 lines of 'unused' batching code and watched p50 feed latency jump from 94ms to 910ms and query count explode from 4 to 180-240 per request — a clean case study in why I/O coalescers need tests, not just comments. Separately, a Redis cache key missing three dimensions (price book version, currency, actor role) silently served wrong data across contracts for 11 days, producing 64 bad quotes and 19 converted invoices. MySQL 9.7 LTS lands with 8 previously enterprise-only features now in Community Edition. Hugging Face's Hub architecture talk is worth reading if you're thinking about MongoDB at scale.

---

## Deleting 412 lines of 'unused' batching code caused a 10x latency regression

The removed code was a DataLoader-style in-process batcher that coalesced per-card identity lookups into bulk queries. The readable replacement — a sequential per-item await loop — silently reintroduced the N+1 problem, pushing Postgres statement count from 4 to 180-240 per feed request and p50 latency from 94ms to 910ms. The fix was rolling back, renaming the batcher to something that signals intent, and adding a CI assertion on max Postgres statement count per feed request. That last part is the actual lesson: code that coalesces I/O needs a test that will catch the next cleanup before it ships. [Read more](https://daily.dev/posts/kg8LKfP43)

## Incomplete Redis cache key served wrong pricing data for 11 days, corrupting 19 invoices

A B2B SaaS team cut p99 checkout latency from 840ms to 210ms by caching a CheckoutContext object in Redis, then found 11 days later that the cache key omitted price book version, currency, and actor role scope. The same blob was served across different contracts and permission levels, producing 64 wrong quotes and 19 converted invoices. The fix required a fully-specified key builder that encodes all dimensions, separate cache keys for authorization and pricing, and outbox events from the admin contract tool so silent SQL writes could trigger invalidation. The root failure was treating cache key design as an afterthought rather than part of the data model. [Read more](https://daily.dev/posts/gSq9xuQJy)

## MySQL 9.7 LTS opens 8 enterprise-only features to Community Edition

MySQL 9.7.0 marks the transition from the 9.x innovation series to a new Long-Term Support line. The release moves 8 previously enterprise-only capabilities into Community Edition across replication/HA, telemetry/OpenTelemetry, JSON Duality Views, and query optimization — including the Hypergraph Optimizer and PGO. Oracle is also introducing a formal governance model with defined contributor roles and publishing public roadmaps on GitHub. Worth watching if you've been holding off on MySQL upgrades waiting for a stable LTS target. [Read more](https://daily.dev/posts/Oanp0En5w)

## Hugging Face Hub: MongoDB Atlas + S3 serving 3M models and 14M users

Hugging Face's infrastructure talk covers how they separated metadata (MongoDB Atlas) from binary artifacts (S3) and migrated search from MongoDB regex queries to Atlas Search backed by Apache Lucene, with pre-computed tokens stored at insert time to kill latency at scale. MongoDB reads are distributed across a 7-node replica set with a hidden node for analytics. Kubernetes HPA scales from 10 to 500 pods, with Cast AI handling node-level autoscaling. Future plans include KEDA for event-driven autoscaling and MongoDB sharding for horizontal scaling of reads and writes — a concrete architecture reference for anyone running metadata stores at this scale. [Read more](https://daily.dev/posts/ddb6Qm6cq)

---

## Also notable

- **Orchestrator v4.31.1 fixes incorrect v4.31.0 tag, adds Prometheus metrics and MySQL 9.7 LTS support:** v4.31.1 supersedes v4.31.0 (tagged from a wrong pre-merge commit) and adds Prometheus metrics for health, instance counts, discovery activity, and recovery duration, plus a new FailRecoveryOnFailedPostFailoverProcesses config option and MySQL 9.7 LTS in the test matrix. [Read more](https://daily.dev/posts/Fjt5ybxjM)
- **DumboDB validates AI-generated MongoDB-compatible database with 1,989 parity tests and nightly AWS load tests:** The team runs 1,989 parity tests against MongoDB as a reference implementation plus ~1,800 assertions for DumboDB-specific features, with nightly AWS load tests that already caught a memory leak in the $group aggregation operator. [Read more](https://daily.dev/posts/q0Mhad20x)
- **Fetch queries 150B rows at 1.9s median on ClickHouse Cloud, including 207M-row intersections under 1 second:** Fetch's FAST analytics agent runs on ClickHouse Cloud with nightly Snowflake-to-S3-to-ClickHouse sync via ClickPipes, handling 500+ queries per day from ~100 users with multi-set intersections across 207 million rows completing in under a second. [Read more](https://daily.dev/posts/VGQZ82Ofs)
- **Amazon S3 Tables adds Variant type for Apache Iceberg V3, enabling schemaless JSON ingestion with Parquet statistics:** S3 Tables now support the Iceberg V3 Variant type, letting you write semi-structured JSON without a fixed schema while Iceberg V3-compatible engines shred the data into hidden columns at write time to generate Parquet column statistics for file pruning — available across 15 AWS regions. [Read more](https://daily.dev/posts/A7lTmEW4l)
- **DynamoDB hot GSI partition (single 'FILE' key) caused silent full scans; four successive bottlenecks found under load testing:** A sync datastore load test exposed a hot GSI partition using a single partition key value that caused full scans on every sync, followed by three more bottlenecks (global lock, index rewrite on every sync, accumulating deleted-model metadata) — each only visible after fixing the previous one. [Read more](https://daily.dev/posts/Ep4FzXZI1)

## Similar posts on daily.dev

- [We Deleted 400 Lines of Code. The App Got Slower.](https://daily.dev/posts/we-deleted-400-lines-of-code-the-app-got-slower--kg8lkfp43) · Medium · 1 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend), [#mysql](https://daily.dev/tags/mysql), [#redis](https://daily.dev/tags/redis)

[View this post on daily.dev](https://daily.dev/posts/n-1-batcher-deleted-cache-key-corruption-hits-19-invoices-dtc7qusy8)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/n-1-batcher-deleted-cache-key-corruption-hits-19-invoices-dtc7qusy8","headline":"N+1 batcher deleted, cache key corruption hits 19 invoices","text":"A team deleted 412 lines of 'unused' batching code and watched p50 feed latency jump from 94ms to 910ms and query count explode from 4 to 180-240 per request — a clean case study in why I/O coalescers need tests, not just comments. Separately, a Redis cache key missing three dimensions (price book version, currency, actor role) silently served wrong data across contracts for 11 days, producing 64 bad quotes and 19 converted invoices. MySQL 9.7 LTS lands with 8 previously enterprise-only features now in Community Edition. Hugging Face's Hub architecture talk is worth reading if you're thinking about MongoDB at scale.","url":"https://daily.dev/posts/n-1-batcher-deleted-cache-key-corruption-hits-19-invoices-dtc7qusy8","datePublished":"2026-07-29T04:18:07.369Z","dateModified":"2026-07-29T04:18:27.805Z","author":{"@type":"Organization","name":"Databases Digest","logo":"https://media.daily.dev/image/upload/s--ir1hdV8b--/f_auto,q_auto/v1773839400/logos/databases_digest?_a=BAMAMiiu0","url":"https://daily.dev/sources/databases_digest"},"interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/databases_digest","name":"Databases Digest"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Databases Digest","item":"https://daily.dev/sources/databases_digest"},{"@type":"ListItem","position":3,"name":"N+1 batcher deleted, cache key corruption hits 19 invoices"}]}
```

