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

Feature Request: improved Online DDL row estimation #13437

Closed
shlomi-noach opened this issue Jul 5, 2023 · 2 comments
Closed

Feature Request: improved Online DDL row estimation #13437

shlomi-noach opened this issue Jul 5, 2023 · 2 comments
Assignees
Labels
Component: Online DDL Online DDL (vitess/native/gh-ost/pt-osc) Type: Feature Request

Comments

@shlomi-noach
Copy link
Contributor

Feature Description

In Online DDL ALTER TABLE migrations, Vitess estimates the number of table rows via SHOW TABLE STATUS. This number can be very skewed. As the migration runs, Vitess indicates its progress in _vt.schema_migrations as a [0..100] value. This column is also exposed in SHOW VITESS_MIGRATIONS output.

The problem is that table_rows can be so skewed that:

  • At some stage rows_copied is actually higher than table_rows. The migration shows 99% or 100% for hours until it actually completes.
  • Or, the migration suddenly terminates at 75%.

This happens because the estimated number of rows can be very much higher or very much lower than the actual number of rows in the table. The user experience is poor as the user is never sure what the actual status is.

Potential approaches:

  1. Run ANALYZE TABLE before/during the migration to get better row estimate. This is an easy solution. The row estimate improves, but still remains imprecise (typically pushing down the error margin to 5%)
  2. Run SELECT COUNT(*) before the migration, and update count with ongoing processed events from the binary log. Problem is that this query may actually run for hours, sometimes even longer than the migration itself. Also, it had better run on a replica.

Use Case(s)

Any long running Online DDL (schema change/migration)

@shlomi-noach
Copy link
Contributor Author

Addressed by #13352

@shlomi-noach
Copy link
Contributor Author

I'm closing this issue as #13352 offers a reasonable solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Online DDL Online DDL (vitess/native/gh-ost/pt-osc) Type: Feature Request
Projects
None yet
Development

No branches or pull requests

1 participant