开发者

Is a pg_dump DB dump 'at-that-time' dump?

开发者 https://www.devze.com 2023-03-18 10:18 出处:网络
I know PostgresQL pg_dump guarantees consistency even if DB is modified while dump is going on, but I want 开发者_如何学运维to know if the final dump contains any data modified/inserted after the dump

I know PostgresQL pg_dump guarantees consistency even if DB is modified while dump is going on, but I want 开发者_如何学运维to know if the final dump contains any data modified/inserted after the dump started.

To elaborate:

  1. Time t: I start pg_dump
  2. Time t+1: There are updates/inserts to the database
  3. Time t+x: pg_dump completes.

I don't want any of the modifications done in the 'x' period to be present in the dump file.

Is this possible?


This was answered in another SO question: Doing pg_dump while still many active transaction.

The short answer is yes: pg_dump opens a transaction and no changes made to the database will be visible to it during the dump, so pg_dump snapshots are atomic and are a consistent snapshot (iow, no foreign key or other constraints will be violated in the snapshot).

HTH

0

精彩评论

暂无评论...
验证码 换一张
取 消