Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable synchronous commit on all connections #2131

Merged
merged 1 commit into from
Feb 3, 2024

Conversation

joto
Copy link
Collaborator

@joto joto commented Feb 2, 2024

This simplifies the code, because we don't have to decide whether to set this or not on each connection. And it doesn't matter much when setting this for read-only connections which don't need this.

Setting synchronous_commit = off speeds up writing to the database, because commis are not delayed until the WAL is written to disk. It can not lead to corruption of the database.

https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT

@joto joto force-pushed the connections-sync-commit branch from 8648488 to 3d45f67 Compare February 2, 2024 13:54
@pnorman
Copy link
Collaborator

pnorman commented Feb 2, 2024

I was thinking turning it off could result in data loss if the DB rolls back but the state files don't, but I guess with storing state in-db that's no longer a concern.

@joto
Copy link
Collaborator Author

joto commented Feb 2, 2024

@pnorman Yes, I should have mentioned that. The osm2pgsql-replication script runs outside osm2pgsql and will store the state in the db after everything else is done. (And it uses sychronous commit.)

This simplifies the code, because we don't have to decide whether to set
this or not on each connection. And it doesn't matter much when setting
this for read-only connections which don't need this.

Setting synchronous_commit = off speeds up writing to the database,
because commis are not delayed until the WAL is written to disk. It
can not lead to corruption of the database.

https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT
@joto joto force-pushed the connections-sync-commit branch from 3d45f67 to dac98d6 Compare February 3, 2024 10:57
@lonvia lonvia merged commit 68eae3f into osm2pgsql-dev:master Feb 3, 2024
26 checks passed
@joto joto deleted the connections-sync-commit branch February 4, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants