MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
awanganddong
V2EX  ›  MySQL

mysql 删除表字段后,表的大小会减小吗

  •  
  •   awanganddong · Mar 24, 2022 · 2646 views
    This topic created in 1522 days ago, the information mentioned may be changed or developed.

    如果是删除数据的话,表大小不变

    然后想问下如果是删除字段的话,表数据大小会改变吗

    6 replies    2022-03-26 00:34:19 +08:00
    CEBBCAT
        1
    CEBBCAT  
       Mar 25, 2022


    ?
    awanganddong
        2
    awanganddong  
    OP
       Mar 25, 2022
    测试过了,表的大小随之减小
    zmal
        3
    zmal  
       Mar 25, 2022
    和数据量有关系,直觉上应该不会减少。
    kkbear
        4
    kkbear  
       Mar 25, 2022
    好像是 alert 命令,哪怕是空的 alert 命令都会对表进行重建操作,所以删掉的字段空间会减少
    MidGap
        5
    MidGap  
       Mar 25, 2022
    会的,alter 了
    815979670
        6
    815979670  
       Mar 26, 2022
    InnoDB 调用了 alter 就会回收空间(我一般是直接重新指定存储引擎,不修改的情况下执行就会回收),但 MyISAM 只能使用 OPTIMIZE TABLE 。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3184 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 13:54 · PVG 21:54 · LAX 06:54 · JFK 09:54
    ♥ Do have faith in what you're doing.