<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/eager-loading-trades-n-1-for-oom-kills-clickhouse-turns-sql-into-an-http-api-czbe8pzsc" -->

---
title: Eager loading trades N+1 for OOM kills, ClickHouse turns...
description: Today's sharpest lesson comes from a production incident where fixing an N+1 query with eager loading cut queries from 801 to 1 but tripled memory usage and...
canonical: https://daily.dev/posts/eager-loading-trades-n-1-for-oom-kills-clickhouse-turns-sql-into-an-http-api-czbe8pzsc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Eager loading trades N+1 for OOM kills, ClickHouse turns SQL into an HTTP API | daily.dev
og:description: Today's sharpest lesson comes from a production incident where fixing an N+1 query with eager loading cut queries from 801 to 1 but tripled memory usage and...
og:url: https://daily.dev/posts/eager-loading-trades-n-1-for-oom-kills-clickhouse-turns-sql-into-an-http-api-czbe8pzsc
og:image: https://api.daily.dev/og/posts/CzBE8pZSc.png
og:image:alt: Eager loading trades N+1 for OOM kills, ClickHouse turns SQL into an HTTP API
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.

# Eager loading trades N+1 for OOM kills, ClickHouse turns SQL into an HTTP API

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

## Summary

Today's sharpest lesson comes from a production incident where fixing an N+1 query with eager loading cut queries from 801 to 1 but tripled memory usage and started getting pods killed. ClickHouse 26.8 shipped two features worth knowing about: named HTTP handlers that let you build a streaming API without an app layer, and a pipelined SQL operator that rewrites how you structure queries. Stripe's idempotency key design gets a solid teardown showing why a lock timeout alone isn't enough to prevent duplicate charges. MariaDB's community poll on plugin languages also has an interesting result if you've ever wanted to write a database extension in something other than C++.

## Content

**TLDR:** Today's sharpest lesson comes from a production incident where fixing an N+1 query with eager loading cut queries from 801 to 1 but tripled memory usage and started getting pods killed. ClickHouse 26.8 shipped two features worth knowing about: named HTTP handlers that let you build a streaming API without an app layer, and a pipelined SQL operator that rewrites how you structure queries. Stripe's idempotency key design gets a solid teardown showing why a lock timeout alone isn't enough to prevent duplicate charges. MariaDB's community poll on plugin languages also has an interesting result if you've ever wanted to write a database extension in something other than C++.

---

## Eager loading fixed N+1 but tripled memory and started killing pods

A team cut an N+1 query problem from 801 queries down to one using eager loading, then watched container memory jump from 420 MB to 1.3 GB under load. The culprit was a Cartesian explosion from joining multiple one-to-many relationships, which turned a single order into 72 repeated rows. The real fix was pagination with bounded IN queries, selecting only needed fields, and pushing summary computation into SQL instead of materializing full object graphs. Query count alone is a bad performance proxy, and this is a good case study for why. [Read more](https://daily.dev/posts/4OqpYkzTH)

## ClickHouse 26.8 turns your database into an HTTP API and rewrites how you write SQL

Named HTTP handlers now let you define typed query parameters, URL path parameters, and streaming response formats (SSE, JSONEachPacketString) directly in ClickHouse, skipping a separate application layer entirely, with per-user grants and SQL SECURITY DEFINER views for access control. The same release introduces pipelined SQL via a new |> operator, letting you chain transformations instead of writing traditional column-first queries; EXPLAIN SYNTAX confirms these compile down to standard nested SELECTs before execution. Both are demoed against a UK property prices dataset. [Read more](https://daily.dev/feed-by-ids?id=d81XREQJq&id=DVtUiMznh)

## Stripe's idempotency keys only work because of a database constraint, not the lock

A rebuild of Stripe's idempotency design shows a 2-second lease producing three rides for one charge because the winning request took longer than the lease to finish. Bumping the lease to 10 seconds fixed that one run but isn't a real fix, since any lock timeout shorter than the slowest honest request is a duplicate generator by construction. The actual guarantee comes from a unique database constraint, not the lease timing, plus atomic phase transitions and recovery points modeled on Stripe's Rocket Rides pattern. [Read more](https://daily.dev/posts/SmrWkjm8z)

## Kafka's exactly-once guarantee stops at the broker, not your consumer logic

A breakdown of Kafka's exactly-once semantics walks through idempotent producers (sequence numbers per partition), transactional IDs with epochs to fence out zombie producers after failover, and a two-phase commit built on an internal 50-partition transaction-state topic. The important caveat: Kafka guarantees exactly-once delivery and storage, not exactly-once processing, because it has zero visibility into what your consumer actually does with a message. [Read more](https://daily.dev/posts/rAzfRNX0d)

---

## Also notable

- **MariaDB plugin language poll favors Python and Rust over C++:** In a community poll on languages for writing MariaDB plugins beyond C++, Python led with 21% and Rust followed at 19%, while only 4% said they'd stick with C++, prompting the Foundation to float embedding a WebAssembly runtime like Wasmtime for language-neutral plugins. [Read more](https://daily.dev/posts/0rNH4sM7j)
- **ClickHouse dataset shows the float32-to-binary embedding tradeoff at scale:** Ten million 1,536-dimension embeddings take 62GB in float32 but shrink to 2GB as packed binary vectors, a roughly 32x reduction that enables XOR-based similarity search but requires rescoring with higher-precision embeddings afterward. [Read more](https://daily.dev/posts/XRWX2u8JS)
- **AWS DevOps Agent cuts DMS migration root-cause time from tens of minutes to minutes:** A sample MCP server extending AWS DevOps Agent exposes 20 read-only tools and 46 runbooks that correlate DMS task state, CloudWatch metrics, and RDS Performance Insights, and in test scenarios it pinpointed a validation race condition caused by ValidationQueryCdcDelaySeconds set to 0. [Read more](https://daily.dev/posts/xFqpK5rKH)

## Similar posts on daily.dev

- [We Fixed N\+1 With Eager Loading. Memory Usage Tripled.](https://daily.dev/posts/we-fixed-n-1-with-eager-loading-memory-usage-tripled--4oqpykzth) · Medium · 54 upvotes · 7 comments
- [ClickHouse release 26.10](https://daily.dev/posts/clickhouse-release-26-10-bz5e15ytp) · ClickHouse · 1 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#kafka](https://daily.dev/tags/kafka), [#clickhouse](https://daily.dev/tags/clickhouse)

[View this post on daily.dev](https://daily.dev/posts/eager-loading-trades-n-1-for-oom-kills-clickhouse-turns-sql-into-an-http-api-czbe8pzsc)

```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/eager-loading-trades-n-1-for-oom-kills-clickhouse-turns-sql-into-an-http-api-czbe8pzsc","headline":"Eager loading trades N+1 for OOM kills, ClickHouse turns SQL into an HTTP API","text":"Today's sharpest lesson comes from a production incident where fixing an N+1 query with eager loading cut queries from 801 to 1 but tripled memory usage and started getting pods killed. ClickHouse 26.8 shipped two features worth knowing about: named HTTP handlers that let you build a streaming API without an app layer, and a pipelined SQL operator that rewrites how you structure queries. Stripe's idempotency key design gets a solid teardown showing why a lock timeout alone isn't enough to prevent duplicate charges. MariaDB's community poll on plugin languages also has an interesting result if you've ever wanted to write a database extension in something other than C++.","url":"https://daily.dev/posts/eager-loading-trades-n-1-for-oom-kills-clickhouse-turns-sql-into-an-http-api-czbe8pzsc","datePublished":"2026-09-05T04:17:37.077Z","dateModified":"2026-09-13T20:59:41.062Z","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":2},{"@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":"Eager loading trades N+1 for OOM kills, ClickHouse turns SQL into an HTTP API"}]}
```

