So, I've got Postgres 9.6.2 installed on Windows 10 64bit, and, when I start Windows, 2 things might happen:

  1. The server starts normally. This is the most common one.
  2. The server starts in an inconsistent way that hangs if you try to connect to it, like with psql. Stopping the service is not possible through the Services app. See screenshot.

When it starts inconsist, I can't stop the service. See:


It stays forever in a Stopping state.

I'm not an experienced DBA. Any idea on how to solve this or find the reason?

  • Is anyone connected to it? – Evan Carroll May 26 '17 at 3:02
  • @EvanCarroll. Thanks for the reply. It's just me on a development machine. – andrerpena May 26 '17 at 3:30
  • Do you have any logs showing what happens when it starts and when you try to stop it ? Did you do some peculiar postgresql.conf configuration ? – KookieMonster May 26 '17 at 11:46

Connect with psql and type this commmand

show log_destination;

this will display where logs are. If the output is EVENTLOG, then check Windows Event Viewer for any message from postgresql. I don't think log_destination is CSVLOG nor SYSLOG, so the last possible value is STDERR. In this case I don't think you may get the messages. In order to change your configuration and use event log, see https://www.postgresql.org/docs/9.6/static/event-log-registration.html .

Once you know where the log is, check its content and you should be able to find the cause of your problem.

| improve this answer | |
  • @miracle173 thanks, I just corrected these errors. – eppesuig Jun 5 '17 at 8:11

You should definitely find your log as eppesuig taold you.

To stop your server, did you try stopping it with pg_ctl ?

You could find this documentation usefull: https://www.postgresql.org/docs/current/static/app-pg-ctl.html

You might want to try pg_ctl stop [-W] [-t seconds] [-s] [-D datadir] -m smart

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.