I have set up PostgreSQL with streaming replication. It replicates very fast, in a fraction of a second. I'd like to insert a delay of 5, maybe 10, maybe 15 seconds, so that bugs related to replication manifest themselves clearly and developers can fix them. Is this possible?
I'd recommend solving this by using WAL archiving and replay instead of streaming replication. With a suitable
archive_timeout
this will give you a significant replication delays.It isn't a great idea for production - it's better to use streaming replication with WAL archiving as a fallback - but I suspect it'd be very good for the testing requirements you have.