PostgreSQL 11 Windows 10 Truncates All Tables on Shutdown
Solution


  Remove the UNLOGGED option from all table create commands


Result


  The data no longer disappears during system shutdown or reboot


I had been using CREATE UNLOGGED for a long time, as I found that in earlier versions of PostgreSQL, it made a HUGE impact in the execution time of my SQL scripts. In one case, it dropped from 15 minutes to around 45 seconds. Every once in a great while, like once or twice a year, I would find the tables had emptied out. I would just go ahead and reload the datasets, never really thinking more about it.

But when I migrated my datasets to PostgreSQL 11.x, I found that the tables emptied out every time I shut down the laptop. Thanks to the comments above, I learned that the UNLOGGED option was indeed the culprit here. I removed that option from all the table creation commands, and the data no longer disappears during reboot.

Added Benefit


  I did not find any appreciable decline in performance while doing this i PostgreSQL 11.x!