Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can't give you the blow-by-blow (feature request <a href="http://bugs.mysql.com/bug.php?id=34354" rel="nofollow noreferrer">#34354</a> would help, except that it probably wouldn't be back-ported to MySQL 5.0), but the extra time is due to the fact that an <code>ALTER ... CHANGE</code> may change the type of the column (and column attributes, if any), which necessitates converting the values stored in the column and other checks. MySQL 5.0 doesn't include optimizations for when the new type and attributes are the same as the old. From the documentation for <a href="http://dev.mysql.com/doc/refman/5.0/en/alter-table.html" rel="nofollow noreferrer"><code>ALTER</code></a> under MySQL 5.0:</p> <blockquote> <p>In most cases, ALTER TABLE works by making a temporary copy of the original table. The alteration is performed on the copy, and then the original table is deleted and the new one is renamed. While ALTER TABLE is executing, the original table is readable by other sessions. Updates and writes to the table are stalled until the new table is ready, and then are automatically redirected to the new table without any failed updates.</p> <p>[...]</p> <p>If you use any option to ALTER TABLE other than RENAME, MySQL always creates a temporary table, even if the data wouldn't strictly need to be copied (such as when you change the name of a column).</p> </blockquote> <p>Under 5.1, <a href="http://dev.mysql.com/doc/refman/5.1/en/alter-table.html" rel="nofollow noreferrer"><code>ALTER</code></a> has some additional optimizations:</p> <blockquote> <p>In some cases, no temporary table is necessary:</p> <ul> <li><p>Alterations that modify only table metadata and not table data can be made immediately by altering the table's .frm file and not touching table contents. The following changes are fast alterations that can be made this way:</p> <ul> <li>Renaming a column, <strong>except for the InnoDB storage engine</strong>.</li> </ul></li> </ul> <p>[...]</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload