---
title: "How one query ate 2 TB of RAM"
publication: "Postgres Weekly"
issue: 640
published_at: "2026-03-18"
canonical_url: "https://postgresweekly.com/issues/640"
---

Plus Netflix's epic RDS to Aurora migration, building an OLAP stack on Postgres, and streaming Postgres logs to HTTP endpoints the easy way.       

#​640 — March 18, 2026 

[Web Version](https://postgresweekly.com/issues/640)  

Together with [![Tiger Data logo\](https://res.cloudinary.com/cpress/image/upload/c_fill,g_auto,w_1280,h_282/e_make_transparent/co_white,e_outline:30/px1u7kjyvz7xnbm6ytir.png)](https://www.tigerdata.com/timescaledb?utm_source=cooperpress&utm_medium=referral&utm_campaign=postgres-weekly-newsletter)   

Postgres Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60,q_auto/bg5bo8e2gztsetgvhrbo.jpg)](https://mydbanotebook.org/posts/work_mem-its-a-trap/)  

[`work_mem`: It's a Trap!](https://mydbanotebook.org/posts/work_mem-its-a-trap/) — With 2 terabytes of RAM and `work_mem` set to 2MB, you wouldn’t expect your Postgres server to get taken down by the OOM (Out-Of-Memory) killer. Nonetheless, a badly written query _did_ cause that very situation, and two expert Postgres developers uncovered the surprising reason behind it. 

Lætitia Avrot and Henrietta Dombrovskaya   

💡 I enjoyed when Lætitia said _"twenty years of Postgres and I learn something new every week"_ in regards to [`pg_log_backend_memory_contexts()`](https://pgpedia.info/p/pg_log_backend_memory_contexts.html) – you can [learn more about its use in tuning `work_mem` here.](https://pganalyze.com/blog/5mins-postgres-work-mem-tuning)  [![\](https://res.cloudinary.com/cpress/image/upload/c_limit,w_480,h_480,q_auto/copm/b812e1cc.png)](https://www.tigerdata.com/timescaledb?utm_source=cooperpress&utm_medium=referral&utm_campaign=postgres-weekly-newsletter) 

[`SELECT COUNT(*)` Shouldn't Take 8 Seconds](https://www.tigerdata.com/timescaledb?utm_source=cooperpress&utm_medium=referral&utm_campaign=postgres-weekly-newsletter) — Tables grow. Queries slow down. Most teams add a second database. But Postgres can handle it. TimescaleDB adds hypertables, 95% compression, and continuous aggregates. Analytics on live data, same SQL you already write. [Start building for free](https://www.tigerdata.com/timescaledb?utm_source=cooperpress&utm_medium=referral&utm_campaign=postgres-weekly-newsletter). 

Tiger Data (creators of TimescaleDB) sponsor   

**IN BRIEF:** 

- 🤖 Bruce Momjian says [the `COMMENT` command could be particularly useful for MCP use cases](https://momjian.us/main/blogs/pgblog/2026.html#March_16_2026) by providing extra metadata for LLMs to use (or as a way to store their own).
- EDB's Floor Drees shares [a sneak preview of the topics coming up at PGConf.dev](https://www.enterprisedb.com/blog/future-postgres-agenda-edbs-pgconfdev-preview) in Vancouver this May.
- The PGCA (PostgreSQL Community Association) has [significantly updated its site](https://www.postgres.ca/) and explains its role in defending Postgres's various trademarks and how you can help support it.
- Pavel Luzanov [rounds up the latest CommitFest](https://postgrespro.com/blog/pgsql/5972815) and a myriad of features set to land in Postgres 19 because of it.   

[How Netflix Automated Its RDS Postgres to Aurora Postgres Migration](https://netflixtechblog.com/automating-rds-postgres-to-aurora-postgres-migration-261ca045447f) — Back in 2024, Netflix decided to migrate hundreds of Postgres clusters from RDS to Aurora, a challenging task with zero data loss and minimal downtime as must-haves. This is a detailed write-up of the process, and while it was an intra-AWS migration, most of the techniques have universal applicability. 

Kannan, Akintayo, Bharadwaj, et al. (Netflix)   

[We Skipped the OLAP Stack and Built Our Data Warehouse in Postgres](https://xata.io/blog/postgres-data-warehouse) — As a Postgres service, Xata wanted to [eat its own dogfood](https://en.wikipedia.org/wiki/Eating_your_own_dog_food), so here’s how they built their own data warehouse approach on top of vanilla Postgres. 

Noémi Ványi (Xata)   

[Waiting for Postgres 19: Add Non-Text Output Formats to `pg_dumpall`](https://www.depesz.com/2026/03/17/waiting-for-postgresql-19-add-non-text-output-formats-to-pg_dumpall/) — A deeper look at a welcome Postgres 19 change: _“`pg_dumpall` can now produce output in custom, directory, or tar formats in addition to plain text"_.. 

Hubert 'depesz' Lubaczewski   

📄 [Postgres is the Gateway Drug](https://viggy28.dev/article/postgres-gateway-drug/) — Three companies, $1.5B+ in Postgres-related acquisitions in eighteen months. What's going on? Vignesh Ravichandran       

📰 Classifieds   

👾 No success theater. Just engineers sharing what actually broke and how they fixed it. [BugBash](https://antithesis.com/bugbash/conference2026/) 2026, April 23-24 in Washington, DC. 

--- 

Build & share your dev journey using Aiven’s free tier to compete for $1,000. Share your project using #AivenFreeTier by March 31. [Enter here](https://fandf.co/4b60Lm0). 

--- 

🤖 Love Claude? Leverage natural language database operations with the [MCP server for Postgres](https://github.com/pgEdge/pgedge-postgres-mcp).      

**RELEASES AND CODE:**   

[pg_turret: Stream Structured Postgres Logs to HTTP or Kafka Endpoints](https://github.com/lasect/pg_turret) — Hooks into Postgres's `emit_log_hook` to capture events and stream them as structured JSON to HTTP (or Kafka) endpoints in real time without any log file parsing. 

lasect   

[pg_stat_ch: Export Per-Query Postgres Telemetry to ClickHouse](https://github.com/ClickHouse/pg_stat_ch) — The ClickHouse team built a Postgres extension that captures per-query execution telemetry and exports it to ClickHouse in real-time. 

ClickHouse   

[pg_duckpipe: Real-Time CDC for Your Lakehouse](https://pgducklake.select/blog/introducing-pg-duckpipe/) — A new Postgres extension that continuously syncs regular heap tables into [DuckLake](https://ducklake.select/) columnar tables (a Parquet-backed format) via WAL-based CDC. 

Relyt   

- [Tansu 0.6](https://github.com/tansu-io/tansu) – Drop-in replacement for Apache Kafka with Postgres, libSQL/SQLite, S3 or memory storage engines.
- [PostgreSQLCopyHelper 3.0](https://github.com/bytefish/PostgreSQLCopyHelper) – Bulk-inserting data with binary COPY for .NET.
- [pg_timetable 6.3](https://github.com/cybertec-postgresql/pg_timetable/releases/tag/v6.3.0) – Advanced standalone job scheduler.    

**Got a new email?** You can [change your address here](https://postgresweekly.com/edit_subscription/*|UID|*). 

--- 

**Bored of us?** [Click here to stop getting Postgres Weekly](https://postgresweekly.com/leave/*|UID|*). 

--- 

**Got a link for us?** Reply and tell us. We can't include everything but we'll look at anything you send. _Thanks!_ 

--- 

Published by Cooper Press Ltd.
Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom 

Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada. 

[Stop getting this newsletter](https://postgresweekly.com/leave/*|UID|*).
