Database Reference
In-Depth Information
One difference between PostgreSQL and some other RDBMS such as Oracle, DB2, or
SQLServer is that the transaction rollback is very fast. On those other systems, if you shut
down the server in a mode that rolls back transactions, then this can cause the shutdown to
take a while, possibly a very long time. This difference is for internal reasons, and isn't in any
way unsafe.
The Debian/Ubuntu --force option is rather nice, because it first attempts a fast
shutdown, and then if that fails, it performs an immediate shutdown, and then after
that kills the postmaster.
Stopping the server in an emergency
If nothing else is working, we may need to stop the server quickly.
"Break glass in case of emergency."
How to do it...
The basic command to perform an emergency restart on the server is the following:
pg_ctl -D datadir stop -m immediate
We must use an immediate stop mode.
How it works...
When you do an immediate stop, all users have their transactions aborted, and all
connections are disconnected. There is no clean shutdown, nor politeness of any kind.
An immediate mode stop is similar to a database crash. Some cached files will need to be
rebuilt, and the database itself needs to undergo crash recovery when it comes back up.
Note that for DBAs with Oracle experience, immediate mode is the same thing as a
shutdown abort. PostgreSQL immediate mode stop is not the same thing as shutdown
immediate on Oracle.
Reloading the server configuration files
Some PostgreSQL configuration parameters can only be changed by "reloading" the whole
configuration file.
How to do it...
On all platforms, there is a specific command to reload the server, which is as follows:
 
Search WWH ::




Custom Search