mysql 截断归档表

发布于 2024-12-08 17:34:13 字数 131 浏览 0 评论 0原文

我有一个带有存档存储引擎的表,我想清除它。由于引擎定义的原因,deletetruncate 都不起作用。但是除了删除整个表并重新创建它之外,还有其他方法吗?

I have a table with the archive storage engine and I would like to clear it. Neither delete, nor truncate will work because of the engine definition. But is there any other way than dropping the whole table an recreating it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

眼泪都笑了 2024-12-15 17:34:13

另一种解决方法是将其更改为 BLACKHOLE 表,然后将其更改回来。

Another workaround would be to change it to be a BLACKHOLE table, then change it back.

农村范ル 2024-12-15 17:34:13

请参阅 Bug #15558 truncate 不会清除存档存储引擎表上的表

基本上,设计师希望它能以这种方式工作。对该错误的修复是当您尝试对使用 ARCHIVE 存储引擎存储的表使用 truncate 时返回错误。

唯一的解决方法是删除并重新创建表。

See Bug #15558 truncate doesn't clear table on archive storage engine tables

Basically, the designers wanted it to work that way. The fix to that bug was to make it return an error when you try to use truncate on a table stored with the ARCHIVE storage engine.

The only workaround is to DROP and the re-CREATE the table.

征﹌骨岁月お 2024-12-15 17:34:13

DELETE 或 BLACKHOLE 解决方案在大表上速度很慢。最快的解决方案:
像the_table一样创建表the_table2;删除表the_table;将表 the_table2 重命名为 the_table;

DELETE or BLACKHOLE solutions are slow on big tables. The fastest solution:
create table the_table2 like the_table; drop table the_table; rename table the_table2 to the_table;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文