Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 5/8/21 9:23 AM, Ron wrote:
>> Is Windows Postgresql a service? If so then Windows "should" shut it
>> down cleanly when you cleanly power off the machine.
> The log would indicate otherwise:
>
>>> 2021-05-08 10:26:20.783 IST [7360] LOG: database system was
>>> interrupted; last known up at 2021-05-07 18:46:00 IST
>
> So something is not working as it should.
Yeah, that's bad news. In theory, as long as you didn't set
fsync = off, Postgres should be able to recover from an unclean
shutdown. In practice, that requires all the levels of the
hardware and software stack to pay strict attention to write
ordering requirements. It is, um, pretty common for inexpensive
Windows gear to not be very careful about that. I'd say this
particular machine has clearly failed the plug-pull test [1].
If the OP is in the habit of just hitting the power switch
at lunchtime, I'd say he's got to stop doing that. Telling
Windows to shut down will add a few seconds, but greatly
reduce the risk of problems (and not only for Postgres).
If he *did* tell Windows to shut down, then there's something
else that needs adjustment.
regards, tom lane
[1] https://wiki.postgresql.org/wiki/Reliable_Writes