mysql - 创建索引需要太多时间?
我有一个 InnoDB 表,有很多字段,目前有 70 万行。现在,我创建了 3 个枚举列并在它们上创建了一个索引(列中的当前值为 null)。在每列上创建索引大约需要 11 分钟。这是预期的吗?
我发现表上的查询也花费了太多时间。诸如从所有行中选择某一字段(时间戳)值在一定范围内的几列之类的查询需要 2-3 分钟。
该表有大约 20 个字段,其中许多是 varchar(255),其中一些是文本,一些整数等。
机器(VPS)有 512MB 内存和 1Ghz cpu
基本上我想知道这些时间是否意外长,如果是这样,那么是由于我的机器或桌子设计造成的。
I have an InnoDB table, with lots of fields, and currently 0.7M rows. Now, I created 3 enum columns and created an index on them (the current value in the column is null). On each of the columns, creating the index took approx 11 minutes. Is this expected?
I am finding that queries on the table are taking too much time also. Queries like selecting few columns from all rows with one field (timestamp) value within certain range, takes 2-3 minutes.
The table has approx 20 fields, many of them are varchar(255), some of them TEXT, some integers, etc.
The machine (a VPS) has 512MB ram and 1Ghz cpu
Basically I want to know whether these times are unexpectedly long, and if so, then is it due to my machine or table design.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否使用带有 InnoDb 插件的 MySQL 5.1?它具有快速索引创建功能。
Are you using MySQL 5.1 with the InnoDb plugin? That has the fast index create functionality.