-
Notifications
You must be signed in to change notification settings - Fork 689
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
sql: RENAME TABLE
supports renaming multiple tables and across dbs
#19871
Conversation
The atomic rename is often used to swap out a table without having any moment in which the table doesn't exist. The example doesn't show this yet
|
@djshow832: adding LGTM is restricted to approvers and reviewers in OWNERS files. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@djshow832: adding LGTM is restricted to approvers and reviewers in OWNERS files. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
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.
The atomic rename is often used to swap out a table without having any moment in which the table doesn't exist. The example doesn't show this yet
Is this example used to alter table t1? Why not just alter table t1? @dveeden |
One example is archiving data. This allows the archive to have different permissions and columns etc. or be moved to a different server. Somewhat similar to partitioning, but more flexible.
The other example is tools like pt-osc and gh-ost:
These tools don't work with TiDB as they are very MySQL specific, but there might be other tools that also rely on this. And the last example is to switch between views and tables:
Note that TiDB doesn't support writing to the view, but this can still be useful if you have a single writer and many readers. Unfortunately MySQL and TiDB both don't support 'instead-of' triggers ( https://bugs.mysql.com/bug.php?id=16525 ). For TiDB this might also help to work around things that aren't supported for
Note here that after backfilling |
Co-authored-by: Daniël van Eeden <[email protected]>
[LGTM Timeline notifier]Timeline:
|
/approve |
/approve |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hfxsd The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
First-time contributors' checklist
What is changed, added or deleted? (Required)
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions.
What is the related PR or file link(s)?
RENAME TABLE
supports renaming multiple tables and across dbs docs-cn#19452Do your changes match any of the following descriptions?