-
Notifications
You must be signed in to change notification settings - Fork 88
Introduce new options for estimating table sizes #793
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
Conversation
This commit introduces a new option --estimate-table-sizes. When set, pgcopydb will use the relpages value in system catalog to estimate the size of each table. This is done by multiplying the number of pages by the page size. PostgreSQL uses a default of 8KB for page sizes, but can be changed in build time. Optionally, the user can set the environment variable PGCOPYDB_ESTIMATE_TABLE_SIZES to a boolean value to enable the option. If this option is used, we run vacuumdb --analyze-only on the source to update the relpages values before calculating the estimates. In passing, I fixed several things including the following: - Fix comment references to pg_autoctl - Remove some unused functions - Remove reference to non-existing vacuumdb command - Remove --cache and --drop-cache references that are no longer used - Fix typos in vacuum logs and comments - Remove references to pgcopydb_table_size table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change needed, and documentation coverage of the new option.
@@ -729,6 +729,16 @@ PGCOPYDB_SPLIT_TABLES_LARGER_THAN | |||
When ``--split-tables-larger-than`` is ommitted from the command line, | |||
then this environment variable is used. | |||
|
|||
PGCOPYDB_ESTIMATE_TABLE_SIZES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actual documentation coverage for the option is missing, see the option list at https://pgcopydb.readthedocs.io/en/latest/ref/pgcopydb_clone.html#options. In particular, we need to document the vacuumdb
call that is implemented when using that option, as that's not transparent to the user at all.
src/bin/pgcopydb/schema.c
Outdated
int fnbytesestimate = PQfnumber(result, "bytesestimate"); | ||
int fnbytesestimatepp = PQfnumber(result, "pg_size_pretty"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: could we place these in the SQL query column list order?
This commit introduces a new option
--estimate-table-sizes
. When set, pgcopydb will use the relpages value in system catalog to estimate the size of each table. This is done by multiplying the number of pages by the page size. PostgreSQL uses a default of 8KB for page sizes, but can be changed in build time.Optionally, the user can set the environment variable
PGCOPYDB_ESTIMATE_TABLE_SIZES
to a boolean value to enable the option.If this option is used, we run
vacuumdb --analyze-only
on the source to update the relpages values before calculating the estimates.In passing, I fixed several things including the following:
--cache
and--drop-cache
references that are no longer usedpgcopydb_table_size
tableCloses #775