如何取消设置 MyISAM 表上的 MAX_ROWS 表选项?
我有一个这样定义的表:
CREATE TABLE `_debug_log` (
...
) ENGINE=MyISAM AUTO_INCREMENT=896692 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci MAX_ROWS=100000 ROW_FORMAT=COMPRESSED;
我想删除 MAX_ROWS 选项,因为该表不需要它,但我确实需要保留现有数据。有没有办法通过 ALTER 语句取消设置此表选项,或者我需要导出数据,重建表,然后将数据导入回?我检查了有关 MAX_ROWS 的 MySQL 文档,但它只说它需要一个正整数值,而没有说明默认值是什么或 0 值可能会做什么。
I have a table defined as such:
CREATE TABLE `_debug_log` (
...
) ENGINE=MyISAM AUTO_INCREMENT=896692 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci MAX_ROWS=100000 ROW_FORMAT=COMPRESSED;
I'd like to drop the MAX_ROWS option as it isn't necessary for this table, but I do need to keep the existing data. Is there a way to unset this table option via an ALTER statement, or will I need to export the data, rebuild the table and then import the data back in? I checked the MySQL docs on MAX_ROWS, but it only says it requires a positive integer value and doesn't say what the default value is or what a value of 0 might do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于它的价值:
给出:
然后:
给出:
我尝试在运行
ALTER
之前和运行ALTER
之后插入一些数据,它似乎没有受到影响。此外,如果您使用相同的选项创建相同的表,但排除
MAX_ROWS
选项,则插入相同的数据,然后在information_schema.tables
中查看结果数据数据几乎相同(除了明显的差异):For what it is worth:
gives:
then:
gives:
I tried inserting some data before running the
ALTER
and after running theALTER
and it did not seem to be affected.Furthermore, if you create the same table with the same options but exclude the
MAX_ROWS
option, insert the same data and then take a look at the resulting data ininformation_schema.tables
the data is pretty much identical (obvious differences aside):如果您不想使用该选项,只需将其设置为 0:
Just set it to 0 if you don't want to use that option: