HeadlinesBriefing favicon HeadlinesBriefing.com

Hatchet's Supertoast Tables: Solving Postgres Storage for Large JSON Payloads

Hacker News •
×

Hatchet, a workflow engine, faced a critical storage problem as its jsonb columns ballooned Postgres instances with rarely accessed task payloads. The team discovered that even small payloads consumed over 50% of database storage, while larger ones took up more than 90%. This created cost inefficiencies and operational risks as NVMe-backed databases approached capacity limits.

The solution emerged as supertoast tables - a hybrid approach combining hot data in Postgres with cold data offloaded to S3. By partitioning data daily and archiving payloads older than 24 hours, Hatchet achieved both fast access for active tasks and cost-effective storage for historical data. The team initially modeled this as a write-ahead log but encountered high disk pressure from autovacuum operations.

To optimize costs, Hatchet implemented payload batching in S3, compressing multiple payloads into single objects with byte-range references. This reduced PUT requests from tens of thousands per month to a manageable volume, cutting storage costs significantly. The final architecture stores only pointers to S3 objects in Postgres, maintaining consistency while eliminating the bloat that once threatened their database operations.