Rebuilding Tables

You can reclaim disk space on a large scale by rebuilding tables, as follows:

  1. Create a table with the same (or similar) definition as the table to rebuild.
  2. Create projections for the new table.
  3. Copy data from the target table into the new one with INSERT..SELECT.
  4. Drop the old table and its projections.

    Note: Rather than dropping the old table, you can rename it and use it as a backup copy. Before doing so, verify that you have sufficient disk space for both the new and old tables.

  5. Rename the new table with ALTER TABLE..RENAME, using the name of the old table.

Caution: When you rebuild a table, Vertica purges the table of all delete vectors that precede the AHM. This prevents historical queries on any older epoch.

Projection Considerations