Postgresql – Postgres 9.6.2 not stopping on Windows. Any idea

postgresqlpostgresql-9.6windows

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:

https://i.imgur.com/TWh2a2l.png

It stays forever in a Stopping state.

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

Best Answer

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.