---
title: "Zero-Downtime Patching Part 1: Prewarming"
description: "Neon and Databricks Lakebase avoid the post-restart performance hit of cold Postgres caches by prewarming a replacement compute before planned maintenance."
url: "https://swe.quest/articles/zero-downtime-patching-part-1-prewarming-370c0c7ccc8bd249"
canonical: "https://neon.com/blog/prewarming"
source: "Neon"
published: "2026-03-27"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 4
tags: ["postgres","deployment","performance","caching"]
---

# Zero-Downtime Patching Part 1: Prewarming

A post on [Neon](https://swe.quest/sources/neon.md), published 2026-03-27, 4 min read, Deep dive. Original: [https://neon.com/blog/prewarming](https://neon.com/blog/prewarming)

## Summary

Neon and Databricks Lakebase avoid the post-restart performance hit of cold Postgres caches by prewarming a replacement compute before planned maintenance. Shortly before the scheduled restart, the control plane starts a hidden new compute, sends it the list of pages in the primary's cache, and loads them from shared storage. It then tails WAL from Safekeepers, applying only records that touch cached pages, and finally promotes it with pg\_promote without restarting the server. In 10 GB pgbench tests, throughput recovers almost immediately with prewarming, compared with a roughly 70% TPS drop and slow recovery on a cold restart, with the largest gain on read-only workloads.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)

## Prerequisites

- Postgres buffer cache ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- write-ahead logging ([easy posts on Observability](https://swe.quest/tags/observability.md?difficulty=easy))
- replica promotion

## Keywords

Neon, Databricks Lakebase, pg\_prewarm, pgbench, Safekeepers, pg\_promote

## Related posts

- [Cold starts just got hot](https://swe.quest/articles/cold-starts-just-got-hot-2fb157f3acc4ca83.md): Neon · 2023-07-25 · Medium · 7 min read · Serverless, PostgreSQL, Performance engineering, System design
  Neon cut serverless Postgres compute cold starts from 3-6 seconds to roughly 500 ms by skipping work and reframing the problem.
- [Improving Lakebase Postgres Compute Cache on Neon, Part 1](https://swe.quest/articles/improving-lakebase-postgres-compute-cache-on-neon-part-1-96696f73ade727a0.md): Neon · 2026-09-09 · Hard · 9 min read · PostgreSQL, Caching, Performance engineering, Memory management, Virtualization
  On large fixed-size Lakebase Postgres computes, Neon now disables its NVMe-backed local file cache and sets shared buffers to 75% of DRAM (up from a 1 GB cap), backed by explicit 2 MB HugeTLB pages provisioned through host, hypervisor and guest VM.
- [Everyone gets faster writes: We turned off FPW's in Neon](https://swe.quest/articles/everyone-gets-faster-writes-we-turned-off-fpw-s-in-neon-60d0cd25f29077e7.md): Neon · 2026-05-07 · Hard · 7 min read · PostgreSQL, Storage engines, Performance engineering, Distributed databases
  Neon disabled Postgres full-page writes fleet-wide because its stateless compute streams WAL to a Paxos safekeeper quorum and has no local disk pages that can tear.
- [Separation of storage and compute without a performance tradeoff](https://swe.quest/articles/separation-of-storage-and-compute-without-a-performance-tradeoff-25a1b45d403d8baf.md): Neon · 2025-07-11 · Easy · 6 min read · PostgreSQL, Caching, Performance engineering, Serverless, Storage systems
  Neon's Local File Cache (LFC) sits between Postgres shared buffers and Neon's remote multi-tenant page storage.
- [Lakebase Postgres is built on object storage, but 99.99999% of reads never touch it](https://swe.quest/articles/lakebase-postgres-is-built-on-object-storage-but-99-99999-of-reads-never-touch-66e3f7227042e0f9.md): Neon · 2026-11-05 · Medium · 7 min read · PostgreSQL, Storage engines, Caching, Storage systems, Performance engineering
  Lakebase Postgres stores durable history in object storage but keeps it off the read path through tiered caching.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
