Skip to content

Instantly share code, notes, and snippets.

@ndufrane
Forked from kmatt/delay_pg_restore_matviews
Created September 11, 2020 14:01
Show Gist options
  • Save ndufrane/b31a6d3d6213e39aada5403d7c3b78b1 to your computer and use it in GitHub Desktop.
Save ndufrane/b31a6d3d6213e39aada5403d7c3b78b1 to your computer and use it in GitHub Desktop.
Delay materialized view refresh during pg_restore
pg_dump database -Fc backup.dump
pg_restore -l backup.dump | sed '/MATERIALIZED VIEW DATA/d' > restore.lst
pg_restore -L restore.lst -d database backup.dump
pg_restore -l backup.dump | grep 'MATERIALIZED VIEW DATA' > refresh.lst
pg_restore -L refresh.lst -d database backup.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment