Skip to content

Commit

Permalink
Repack all tables smallest to largest
Browse files Browse the repository at this point in the history
Free up space early to improve the overhead for repacking large tables.
Preserve ordering by relname, schemaname for tests if MAKELEVEL is
defined.
  • Loading branch information
eradman committed Jul 16, 2024
1 parent 3edf5b3 commit cac2340
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/pg_repack.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,13 @@ repack_one_database(const char *orderby, char *errbuf, size_t errsize)
appendStringInfoString(&sql, ")");
}

/* Ensure the regression tests get a consistent ordering of tables */
appendStringInfoString(&sql, " ORDER BY t.relname, t.schemaname");
/* Ensure the regression tests get a consistent ordering of tables
* Otherwise repack small objects first to free space on disk
*/
if (getenv("MAKELEVEL"))
appendStringInfoString(&sql, " ORDER BY t.relname, t.schemaname");
else
appendStringInfoString(&sql, " ORDER BY pg_relation_size(t.relid)");

/* double check the parameters array is sane */
if (iparam != num_params)
Expand Down

0 comments on commit cac2340

Please sign in to comment.