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 "8.11.2.2 Stopping the Instance Using the Immediate Mode" or "8.11.2.3 Forcibly Stopping the Server Process".
Example
> pg_ctl stop -D 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 "8.11.2.3 Forcibly Stopping the Server Process".
Example
> pg_ctl stop -D D:\database\inst1 -m immediate
If both the Fast mode and the Immediate mode fail to stop the instance, use the kill parameter of the pg_ctl command to forcibly stop the server process.
The procedure is as follows:
Execute the wmic command to identify the process ID of the server process.
c:\>wmic wmic:root\cli>process where "name = \"postgres.exe\"" get CommandLine,Name,ProcessId CommandLine Name ProcessId : "C:\Program Files\Fujitsu\symfoserver64\bin\postgres.exe" -D "D:\database\inst1" postgres.exe 896 :
The postgres.exe process ID(896) that indicates the data storage destination directory of the applicable instance in the -D option becomes the server process.
Forcibly stop the server process
As instance manager, forcibly stop the server process using the pg_ctl command.
c:\>pg_ctl kill QUIT 896