Skip to content

Instantly share code, notes, and snippets.

@kmatt
Last active January 4, 2024 18:17
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save kmatt/14c8e6ae2cff9e4faa0e to your computer and use it in GitHub Desktop.
Save kmatt/14c8e6ae2cff9e4faa0e 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
@ndufrane
Copy link

thx !

@Jinghua-Li
Copy link

Good,Thanks!

@cazter
Copy link

cazter commented Feb 10, 2021

muchos grassy-ass amigo. which is spanish for you're awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment