Difficulty understanding Postgres synchronous_commit = off and data loss
so I can simply re-run what didn't go through once it's back up, correct?


How would you know to do so?


  Say we wanted to sequentially save 3 items in our database table called numbers: [1, 2, 3] And we have a client that queries the table numbers for what was last saved, and will resume from where it left off.


So it saves all three.  It queries the database and sees all three.  Then it says "OK, I'm good" and exits.  But then the database crashes, and when it comes back up only the 1st one is there.  Unless the client is always periodically rechecking, it won't know anything has been lost in order to fix it.



Another scenario.  One client commits all three rows, and a second program immediately queries and sees all three, and uses that data to make a decision.  If the decision of the second program is recorded exclusively into the database, then you are fine.  If any of those 3 rows are lost, the recorded decision is also lost.  But if that second program sent its decision to something outside the database, then you can have a problem because the external decision survives the crash, but the data upon which the decision was based might no longer exist once the database comes back up.