首页 > 代码库 > mysql中更改字段属性实际上都做了哪些操作
mysql中更改字段属性实际上都做了哪些操作
mysql> set profiling=1;
Query OK, 0 rows affected (0.00 sec)
mysql> alter table test modify name varchar(10);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> show profiles;
+----------+------------+------------------------------------------+
| Query_ID | Duration | Query |
+----------+------------+------------------------------------------+
| 1 | 0.00011200 | alter table test name varchar(10) |
| 2 | 0.00596700 | alter table test modify name varchar(10) |
+----------+------------+------------------------------------------+
2 rows in set (0.00 sec)
mysql> show profile for query 2;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| starting | 0.000063 |
| checking permissions | 0.000002 |
| checking permissions | 0.000008 |
| init | 0.000049 |
| Opening tables | 0.000013 |
| System lock | 0.000005 |
| Table lock | 0.000010 |
| setup | 0.000034 |
| creating table | 0.005007 |
| After create | 0.000131 |
| copy to tmp table | 0.000109 |
| rename result table | 0.000355 |
| end | 0.000037 |
| query end | 0.000003 |
| freeing items | 0.000138 |
| cleaning up | 0.000003 |
+----------------------+----------+
16 rows in set (0.00 sec)
mysql中更改字段属性实际上都做了哪些操作