Resizing a database
A database’s size is the memory its compute may use. Every database starts at the platform’s size (computes.memory, 1 GiB by
default). You can give one database a size of its own, and change it while the database is running.
peat resize orders --memory 4Gi- A running database is resized where it runs. There is no restart: sessions stay connected and queries go on. It takes a few seconds.
- A sleeping database takes its new size the next time it wakes.
As an object:
apiVersion: peat.zabaca.com/v1alpha1kind: Databasemetadata: name: ordersspec: memory: limit: 4Gi # what it may use request: 1Gi # what it is guaranteed; the platform's when left out--request sets the guaranteed part from the command line. Kubernetes places a database on a machine by its request, and stops one
that goes over its limit.
What more memory gives
Section titled “What more memory gives”- More of the local cache in memory. A compute keeps the pages it has read in a cache file on its machine’s disk. The more memory it has, the more of that file is served from memory instead of disk.
- More room for sorts, joins and sessions before a query spills to temporary files.
It does not raise the number of connections a database takes. That is set when the database starts.
When a size cannot be given
Section titled “When a size cannot be given”peat resize waits for the answer and says it in words. peat show and the Database’s status.resize say the same later.
| It says | What it means |
|---|---|
| resized without a restart | Done. status.memory shows what the compute has. |
| its new size waits for room on its machine | The machine is full now. Kubernetes applies the size when room frees up. A larger --request holds that room on its machine while it waits, so other databases may not be placed there: set it back if it should not wait. |
| its new size could not be applied | A limit lowered below what the database holds right now. It keeps its size; try again when it is quieter, or ask for more. |
| its new size was refused, or does not fit its machine | The machine can never hold that request. The database keeps its size. Ask for less, or see below. |
| this cluster cannot resize a running pod | Kubernetes older than 1.33. The size is taken at the database’s next start: peat stop, then connect. |
A resize never moves a database to another machine. A database that needs more than its machine has free takes the new size at its
next start, when it is placed again: peat stop orders, then connect.
Shrinking
Section titled “Shrinking”Lowering a database’s own size works the same way on Kubernetes 1.35 or newer. The cache’s pages in memory are given back as the limit falls, so a database is not stopped for holding cached data. Do not set a limit below what its sessions and queries actually need: a database that goes over its limit is restarted, and its sessions end.
- Kubernetes 1.33 and 1.34 may refuse to lower a running pod’s memory limit. The answer then says it was refused, and the size is taken at the database’s next start.
- The platform’s size made smaller (
computes.memoryon the Platform) does not shrink running databases. Each takes it at its next start. A larger platform size does reach running databases at once.
Which databases take a size
Section titled “Which databases take a size”A size set on a database is that database’s alone. Its branches, its read replicas and the copy a version move works on each have the platform’s size unless you set their own.
A size that follows use
Section titled “A size that follows use”Give a database a least and a most, and Peat sets its size between them by itself:
peat resize orders --min 512Mi --max 8Gispec: autoscale: min: 512Mi max: 8Gi- It starts at the least each time it wakes, whatever it grew to before it slept, and climbs again in steps of a second or two.
- It grows at once. A small watcher beside Postgres reads the database’s own memory four times a second. When what its sessions and queries hold passes three quarters of its limit, it asks for room and gets enough that it sits at half: in our test a database went from 512 MiB to 3.7 GiB in four steps while fourteen sessions piled up 2.3 GB between them, and none was cut.
- It shrinks slowly. After five quiet minutes below 40% of its limit it comes down to twice what it holds, never below the least. Kubernetes refuses to lower a limit below what a database holds, so a shrink cannot squeeze a busy one.
- It does not grow into a full machine. The Database’s
status.scaledsays the last change and why, or that its machine had no room. peat resize orders --memory 4Gisets a fixed size again.
What it follows is the memory that sessions and queries hold. Cached data does not count: it is given back whenever something else needs the room, and it is read from the machine’s disk nearly as fast. So a database under a heavy read load can stay at its least and still be fast.
What it cannot outrun: one query that takes gigabytes within a second or two. A resize takes a second or two to land, and a
database that passes its limit first is restarted. Set a least large enough for your heaviest single query, or cap what one query may
use (work_mem).
A database given a least and a most while it is running takes the watcher at its next start; until then its size is still adjusted, from a reading that is some seconds old.
It needs Kubernetes 1.33 or newer. On an older cluster the database runs at its least. A size that follows use is in release-2026-11-29.2 and later.