Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
5.5.36, 10.0.10
-
None
-
None
-
32-Bit Debian 7
Description
When adding or removing a non-materialized virtual column to/from a MyISAM table with ALTER TABLE, MariaDB recreates the whole table although only the metadata should be affected:
MariaDB [test]> ALTER TABLE test ADD COLUMN testcolumn INT AS (othercolumn+1) VIRTUAL;
|
Stage: 1 of 2 'copy to tmp table' 0.001% of stage done
|
This is especially annoying for multi-gigabyte tables, where this operation takes a long time.
Attachments
Issue Links
- relates to
-
MDEV-6303 MyISAM/Aria: Adding/removing non-materialized virtual column triggers table recreation
-
- Open
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
When adding or removing a non-materialized virtual column to/from a MyISAM table with ALTER TABLE, MariaDB recreates the whole table although only the metadata should be affected: MariaDB [test]> ALTER TABLE test ADD COLUMN testcolumn INT AS (othercolumn+1) VIRTUAL; Stage: 1 of 2 'copy to tmp table' 0.001% of stage done This is especially annoying for multi-gigabyte tables, where this operation takes a long time. |
When adding or removing a non-materialized virtual column to/from a MyISAM table with ALTER TABLE, MariaDB recreates the whole table although only the metadata should be affected: {noformat} MariaDB [test]> ALTER TABLE test ADD COLUMN testcolumn INT AS (othercolumn+1) VIRTUAL; Stage: 1 of 2 'copy to tmp table' 0.001% of stage done {noformat} This is especially annoying for multi-gigabyte tables, where this operation takes a long time. |
Fix Version/s | 10.0.11 [ 15200 ] | |
Fix Version/s | 5.5.38 [ 15400 ] |
Priority | Minor [ 4 ] | Major [ 3 ] |
Fix Version/s | 10.0.12 [ 15201 ] | |
Fix Version/s | 10.0.11 [ 15200 ] |
Assignee | Sergey Vojtovich [ svoj ] |
Attachment | mdev6103.patch [ 30502 ] |
Assignee | Sergey Vojtovich [ svoj ] | Sergei Golubchik [ serg ] |
Assignee | Sergei Golubchik [ serg ] | Sergey Vojtovich [ svoj ] |
Fix Version/s | 5.5.38 [ 15400 ] |
Assignee | Sergey Vojtovich [ svoj ] | Sergei Golubchik [ serg ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Assignee | Sergei Golubchik [ serg ] | Sergey Vojtovich [ svoj ] |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Workflow | defaullt [ 38918 ] | MariaDB v2 [ 43917 ] |
Workflow | MariaDB v2 [ 43917 ] | MariaDB v3 [ 63151 ] |
Workflow | MariaDB v3 [ 63151 ] | MariaDB v4 [ 147796 ] |
It came to be that MyISAM (and most probably Aria) reserves extra bits for virtual columns (NULL flag) in a physical record (the one that is written to disk). There should be no good reason to do so.
E.g.:
create table t1 (b int, d int); # Uses 2nd and 3rd bits for NULL flags
create table t2 (a int as (-b), b int, c int as (-b), d int); # Uses 3rd and 5th bits for NULL flags
All in all it means physical record format changes when adding/dropping virtual columns and just relaxing table comparison function is not enough to fix this bug.
I will attach partial fix for this bug shortly. InnoDB doesn't seem to be affected.