Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repack all tables smallest to largest #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading