Sleep and wake
A database nobody is using is put to sleep: its compute, the Postgres process, is removed. Its data stays in the storage. The next connection wakes it.
What a client sees
Section titled “What a client sees”- Awake: an ordinary Postgres connection.
- Asleep: the connection is held at the front door while a compute starts, usually a few seconds (one to six in our tests), and then goes through. Nothing special is needed in the client except patience: allow a connect timeout of a minute.
- Sessions do not survive a sleep. A database only sleeps when it has no session, so nothing is cut off, but session state and temporary tables from before are gone, as after any reconnect.
Setting the idle time
Section titled “Setting the idle time”For every database, on the Platform (30 minutes by default):
spec: computes: idleAfter: 30mFor one database, on the Database, in whole minutes:
spec: idleAfter: 5mA change applies to a database that is awake, too.
By hand
Section titled “By hand”peat stop orders # asleep now; the next connection wakes itpeat close orders # refuses every connection and stays asleeppeat open orders # takes connections againpeat show orders # says whether it is awakeUse close when a database must not be touched, during an investigation for instance. A closed database does not wake.
Keeping one awake
Section titled “Keeping one awake”There is no “never sleep” switch. A client that holds a session open keeps its database awake; a connection pool with one idle
connection is enough. Set a long idleAfter for a database that should ride out quiet periods.