简体   繁体   English

运行ALTER添加新列时,tmp表未增长

[英]tmp table not growing when running ALTER to add new column

I have about a 25 GB table that I have to add a column to. 我有大约25 GB的表,必须在其中添加一列。

I run a script and when I execute it, I can see the temp table in the data directory but it stays stuck at about 480K. 我运行了一个脚本,当我执行它时,我可以在数据目录中看到临时表,但它停留在大约480K。 I can see in processlist that the ALTER is running and there are no issues. 我可以在进程列表中看到ALTER正在运行,并且没有问题。

If I kill the script after a long period of activity, then in processlist the query remains in "killed" state and the tmp file will start growing until the query is LITERALLY killed (ie., goes from "killed" state in processlist to disappearing off of the processlist altogether). 如果经过长时间的活动后我杀死了脚本,那么在进程列表中查询将保持“ killed”状态,并且tmp文件将开始增长,直到查询被彻底杀死(即,从processlist中的“ killed”状态变为消失)完全不在进程列表中)。

When I run the following (before killing the query): 当我运行以下命令(在终止查询之前):

select * from global_temporary_tables\G

it doesn't show any rows being added either. 它也不显示任何被添加的行。

Is there anything else I can do? 我还能做些什么吗?

Firstly, what your "ps" output report may show has nothing to do with anything. 首先,您的“ ps”输出报告可能显示的内容与任何内容均无关。 Don't rely upon what "ps" says: it includes stale data. 不要依赖“ ps”所说的内容:它包含过时的数据。

If the process has been killed (SIGKILL, not SIGTERM), I guarantee you it is no longer delivering any output to anywhere. 如果该进程已被终止(SIGKILL,而不是SIGTERM),我保证您不再将任何输出传递到任何地方。 If it's been SIGTERMed, it depends what signal handlers you've attached. 如果是SIGTERMed,则取决于您所连接的信号处理程序。 I'm going to hazard a wild guess that you haven't registered any signal handlers. 我要大胆地猜测您还没有注册任何信号处理程序。

Most production DBMS set up storage in chunks. 大多数生产DBMS会分块设置存储。 X amount of space is obtained, which may contain "slack" room that enables rows and/or columns to be added (I do NOT say that the two mechanisms are identical). 获得X的空间量,其中可能包含“松弛”空间,可以添加行和/或列(我不说这两种机制是相同的)。 Just because something didn't grow in a manner that you could perceive doesn't mean that the changes weren't made. 仅仅因为某些事情没有以您可以感知的方式增长,并不意味着未进行任何更改。 Why not check out the data dictionary, interrogating the current structure of the table. 为什么不检出数据字典,询问表的当前结构。

Did you COMMIT your changes? 您提交更改了吗? In some DBMS, DDL operations are regarded as committable/rollbackable (yecch) events. 在某些DBMS中,DDL操作被视为可提交/可回滚(yecch)事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM