Linux Labs

Web stack / Stage 8 of 9

A dump and a verified restore

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 7 · summary · 2 min

Summary

  • A logical dump is commands: create the tables, load the rows, set the counters, add the keys; pg_restore runs a custom archive, psql runs plain SQL.
  • A dump is not restored into a working database: CREATE and COPY fail, while setval goes through and rolls the counter back.
  • Testing a dump means restoring it into a new, empty database and comparing it with the original: rows, md5, the counter.
  • The new order at the start of the lesson failed because of the counter: pg_restore set orders_id_seq back to yesterday's 5, and the database handed out the taken id 6.
Ubuntu 24.04
Loading…