til icon indicating copy to clipboard operation
til copied to clipboard

Commit trong PostgreSQL là làm những gì?

Open xluffy opened this issue 8 months ago • 0 comments

In most cases, all a COMMIT has to do is

  • set the two bits for the transaction in the commit log to TRANSACTION_STATUS_COMMITTED (0b01) (persisted in pg_xact)
  • if track_commit_timestamp is set to on, record the commit timestamp (persisted in pg_commit_ts)
  • flush the write-ahead log (WAL) (persisted in pg_wal) to disk, unless synchronous_commit is set to off

Note that because of the multi-versioning architecture of PostgreSQL, both COMMIT and ROLLBACK are normally very fast operations: they both don't have to touch the tables, they only register the status of the transaction in the commit log.

https://www.cybertec-postgresql.com/en/why-do-i-have-a-slow-commit-in-postgresql/

xluffy avatar May 29 '24 01:05 xluffy