-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Count rows queries #1442
Open
BarShauli555
wants to merge
19
commits into
github:master
Choose a base branch
from
wix-playground:count_rows_queries
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Count rows queries #1442
+143
−55
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
online schema changes with deletion. architecture as detailed explained here: https://kb.wixpress.com/x/8pocBQ Where clause condition will always receive the default 1=1. in case we would like to delete table data we will use the where clause as in a "select" meaning we will put the data we want to save in the where clause. to include values on the where clause - use the condition as it is. for exclude values please put "not" before. Please note : Where clause condition will be enforced only from the source table and not from the binlog. meaning if I put a where clause of id < 100, and id # 2 was updated \ inserted, it will be in the new table because this DML will be taken from the binlog. this is a feature since this is newly update\insert otherwise it should be inserted into the binlogs as a deleted row. If you are using one filter operation with in , please don't put more than 5 values. otherwise please use the sub-select option. For hash \ string it is better to use the sub-select option, avoiding string manipulation issues in the middle (Jenkins, ansible, Casper). Where clause can not be edited in the middle of ghost run.
BarShauli555
requested review from
rashiq,
meiji163 and
timvaillancourt
as code owners
August 18, 2024 12:12
BarShauli555
force-pushed
the
count_rows_queries
branch
from
August 18, 2024 12:27
47139a4
to
98dc355
Compare
meiji163
reviewed
Nov 7, 2024
@@ -554,7 +554,7 @@ func (this *Inspector) CountTableRows(ctx context.Context) error { | |||
return err | |||
} | |||
|
|||
query := fmt.Sprintf(`select /* gh-ost */ count(*) as count_rows from %s.%s`, sql.EscapeName(this.migrationContext.DatabaseName), sql.EscapeName(this.migrationContext.OriginalTableName)) | |||
query := fmt.Sprintf(`select /* gh-ost */ table_rows as count_rows from information_schema.tables where table_schema="%s" and table_name="%s"`, sql.EscapeName(this.migrationContext.DatabaseName), sql.EscapeName(this.migrationContext.OriginalTableName)) |
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.
table_rows from information_schema is an estimate, not necessarily the exact row count. Elsewhere we estimate the row count if select count(*)
cannot complete. So we do not wish to change this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A Pull Request should be associated with an Issue.
Related issue: https://github.com/github/gh-ost/issues/0123456789
Description
This PR [briefly explain what it does]
script/cibuild
returns with no formatting errors, build errors or unit test errors.