In PostgreSQL 10 it is possible to make synchronous or asynchronous replications. PostgreSQL streaming replication is asynchronous by default. If the primary server crashes then some transactions that were committed may not have been replicated to the standby server, causing data loss. The amount of data loss is proportional to the replication delay at the time of failover.
Synchronous replication offers the ability to confirm that all changes made by a transaction have been transferred to one or more synchronous standby servers; in a synchronous replica, every time a transaction is committed, PostgreSQL will wait until the commit operation to be written both on the primary WAL and on the stand-by WAL; synchronous replication provides greater data protection in case of disaster, but it can slow down write operations. Here are some parameters to reach this...