Restarting the database server quickly

Sometimes there are situations where you need a database bounce. This is most likely for the database parameters that require a server restart to come into effect. This is different from the reload option of the server configuration, which only reloads the configuration files without requiring a server bounce.

How to do it...

We can use the following command to restart the database server:

pg_ctl -D /var/lib/pgsql/9.6/data restart

Here, /var/lig/pgsql/9.6/data is the location of the data directory of the PostgreSQL server.

How it works...

Using the restart mode of the pg_ctl command first stops the running databases on the PostgreSQL server and then starts the server. It is in effect a two-way process, where ...

Get PostgreSQL High Performance Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.