There are three methods:
Stopping the Instance Using the Fast Mode
If backup is in progress, then terminate it, roll back all executing transactions, forcibly close client connections, and then stop the instance.
Stopping the Instance Using the Immediate Mode
Forcibly terminate the instance immediately. A crash recovery is run when the instance is restarted.
Forcibly Stopping the Server Process
Reliably stops the server process when the other methods are unsuccessful.
Specify "-m fast" in the pg_ctl command to stop the instance.
If the instance fails to stop when you use this method, stop the instance as described in "17.11.2.2 Stopping the Instance Using the Immediate Mode" or "17.11.2.3 Forcibly Stopping the Server Process".
Example
> pg_ctl stop -D /database/inst1 -m fast
Specify "-m immediate " in the pg_ctl command to stop the instance.
If the instance fails to stop when you use this method, stop the instance as described in "17.11.2.3 Forcibly Stopping the Server Process".
Example
> pg_ctl stop -D /database/inst1 -m immediate
If both the Fast mode and the Immediate mode fail to stop the instance, use the kill command or the kill parameter of the pg_ctl command to forcibly stop the server process.
The procedure is as follows:
Execute the ps command
Note that "<x>" indicates the product version.
> ps axwfo user,pid,ppid,tty,command | grep postgres fsepuser 19174 18027 pts/1 \_ grep postgres fsepuser 20517 1 ? /opt/fsepv<x>server64/bin/postgres -D /database/inst1 fsepuser 20518 20517 ? \_ postgres: logger fsepuser 20520 20517 ? \_ postgres: checkpointer fsepuser 20521 20517 ? \_ postgres: background writer fsepuser 20522 20517 ? \_ postgres: walwriter fsepuser 20523 20517 ? \_ postgres: autovacuum launcher fsepuser 20524 20517 ? \_ postgres: archiver fsepuser 20525 20517 ? \_ postgres: logical replication launcher
The process ID (20517) indicates the server process.
Forcibly stop the server process
As instance manager, forcibly stop the server process.
> pg_ctl kill SIGQUIT 20517
> kill -s SIGQUIT 20517