[MDEV-30340] Implement EXPLAIN for DDL such as ALTER TABLE Created: 2019-09-05 Updated: 2023-11-30 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Ralf Gebhardt |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
It would be useful if EXPLAIN supported ALTER TABLE and/or other DDL statements. For example, something like this:
And probably also something like this:
The output should probably include:
The more basic pieces of information could probably be output by EXPLAIN, and the more detailed pieces of information could probably be output by EXPLAIN EXTENDED. |
| Comments |
| Comment by Marko Mäkelä [ 2019-09-06 ] | ||||||||||||||||||||||||||||||||
|
Most of this information will be delivered by storage engines via the existing virtual member function handler::check_if_supported_inplace_alter() already. As far as I can tell, the only question that the handler API cannot currently answer is whether a table is in the non-canonical format that was introduced by Note that an ALGORITHM=NOCOPY operation may convert a table to non-canonical format, even though the complete operation is not ALGORITHM=INSTANT. Also, the table may already be in non-canonical format, and as a result of ALTER, it can either be in canonical or non-canonical format. For example, if the table would be rebuilt due to the FORCE keyword, or due to changing the data type of a column, the table would always be in the canonical format. The changes to InnoDB should be minimal (doable in a few hours, once the storage engine interface changes have been implemented in a development branch). The bulk of this work should be done outside storage engines. | ||||||||||||||||||||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2019-09-06 ] | ||||||||||||||||||||||||||||||||
|
Hi marko,
SHOW TABLE STATUS would provide the table's current ROW_FORMAT value. If we support EXPLAIN for ALTER TABLE, then I was thinking that EXPLAIN should ask the storage engine whether the ROW_FORMAT of the table will be changed by the ALTER TABLE. It is not always obvious. For example, some users may not expect the row format of the table to change in the following case, if they were not aware that the value of innodb_default_row_format has been changed, or if they were not aware that the FORCE keyword could cause the ROW_FORMAT to change:
| ||||||||||||||||||||||||||||||||
| Comment by Julien Fritsch [ 2019-10-18 ] | ||||||||||||||||||||||||||||||||
|
Can you please clarify the FixVersion, please? | ||||||||||||||||||||||||||||||||
| Comment by Julien Fritsch [ 2019-11-18 ] | ||||||||||||||||||||||||||||||||
|
Hi, sorry to spam you, but please add a fixVersion to those MENT issues. |