Skip to content

Moving tables to new tablespace

adamhooper edited this page Nov 25, 2014 · 6 revisions

[Adam, 2014-11-25]

Requirements

  • Save space on the "old" database volume
  • Zero downtime

Assumptions

  • The "old" database volume is filled mostly by file contents, which we'll be removing as we do this migration
  • Staging will be up the entire time

Approach

  1. Create a new volume on EC2 and mount it
  2. Make Postgres aware of the new volume
  3. Use pg_repack to move tables from the old volume to the new one.

Steps

Ran all these steps on staging/database first, then on production/database.

Clone this wiki locally