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

Option to Perform ALTER ONLINE (or ALGORITHM=INPLACE) #15312

Closed
nunoperalta opened this issue Jun 8, 2019 · 9 comments · Fixed by #15420, #15808 or #15832
Closed

Option to Perform ALTER ONLINE (or ALGORITHM=INPLACE) #15312

nunoperalta opened this issue Jun 8, 2019 · 9 comments · Fixed by #15420, #15808 or #15832
Assignees
Labels
enhancement A feature request for improving phpMyAdmin has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
Milestone

Comments

@nunoperalta
Copy link

nunoperalta commented Jun 8, 2019

When editing the structure of a table, it would be nice to have an option next to the "Preview SQL" button to try an Online Transaction.

image

This would perform the ALTER TABLE with either:

ALTER ONLINE or ALGORITHM=INPLACE

Many times, I want to try to see if I can make a change in the database without locking the table. I could simply select this option and try. If it gives an error saying it's not possible to perform online, then I can try again when the traffic is low.

At the moment, the way I do it is by doing "Preview SQL", copy the generated SQL, and add the word "ONLINE" to it, and try the SQL manually.
Having this checkbox would be a nice feature to avoid these extra steps :)

Thank you.

@williamdes williamdes added the enhancement A feature request for improving phpMyAdmin label Jun 8, 2019
@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Aug 20, 2019
williamdes pushed a commit to kartik1000/phpmyadmin that referenced this issue Jan 1, 2020
Fixes phpmyadmin#15312

Signed-off-by: Kartik Kathuria <kathuriakartik0@gmail.com>
@ibennetch
Copy link
Member

ibennetch commented Jan 1, 2020 via email

@williamdes
Copy link
Member

@ibennetch the PR #15420 adds an option for 'ONLINE' only

@williamdes williamdes added this to Needs triage in issues via automation Jan 1, 2020
@williamdes williamdes moved this from Needs triage to Enhancements in issues Jan 1, 2020
@williamdes williamdes self-assigned this Jan 16, 2020
@williamdes williamdes added this to the 5.1.0 milestone Jan 16, 2020
williamdes pushed a commit to kartik1000/phpmyadmin that referenced this issue Jan 16, 2020
Fixes phpmyadmin#15312

Signed-off-by: Kartik Kathuria <kathuriakartik0@gmail.com>
williamdes pushed a commit to kartik1000/phpmyadmin that referenced this issue Jan 16, 2020
Fixes phpmyadmin#15312

Signed-off-by: Kartik Kathuria <kathuriakartik0@gmail.com>
@williamdes
Copy link
Member

image

Thank you @kartik1000 for implementing this feature
I added a documentation button

@nunoperalta
Copy link
Author

OMG - this!!!
Thank you so much @kartik1000 - you rock.

Just one thing - I believe that ALTER ONLINE is MariaDB specific.
For MySQL, I think we should use "ALGORITHM=INPLACE".

Unless I'm wrong?

@williamdes
Copy link
Member

Unless I'm wrong?

I found it in the MySQL docs https://dev.mysql.com/doc/refman/8.0/en/alter-table.html so I do not think it is specific at all :)

@nunoperalta
Copy link
Author

nunoperalta commented Jan 16, 2020

I did a search in that page for "ONLINE", but I don't see it as part of the syntax.
Can you please quote the specific part that says "ALTER ONLINE TABLE" is allowed?

Also, I tried in phpMyAdmin Demo with MySQL, I got:

ALTER ONLINE TABLE BanNumber ADD test INT NOT NULL AFTER NbdeBans
MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ONLINE TABLE BanNumber ADD test INT NOT NULL AFTER NbdeBans' at line 1

@williamdes
Copy link
Member

williamdes commented Jan 16, 2020

Indeed, I did read the docs too quicky

So for MySQL and MariaDB we need to use ALGORITHM=INPLACE ?

https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl.html
https://mariadb.com/kb/en/innodb-online-ddl-overview/

https://mariadb.com/kb/en/alter-table/#algorithminplace seems to be a more compatible method

@kartik1000
Copy link
Contributor

Does Algorithm = Inplace works for both MariaDB and MySQL? Or we need to use different syntax on the basis of server?

@nunoperalta
Copy link
Author

@kartik1000 @williamdes Should work for both.

Thank you!

williamdes added a commit that referenced this issue Jan 17, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from Enhancements to Closed Jan 17, 2020
williamdes added a commit that referenced this issue Jan 19, 2020
Fixes: #15312
Pull-request: #15808
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Jan 22, 2020
…tion

Fixes: #15312
Pull-request: #15832
Signed-off-by: William Desportes <williamdes@wdes.fr>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement A feature request for improving phpMyAdmin has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
issues
  
Closed
4 participants