创建索引需要很长的时间
大约2个月前,我进口EnWikipedia数据(http://dumps.wikimedia.org/enwiki/20120211/)到MySQL。创建索引需要很长的时间
完成导入EnWikipedia数据,我一直在约2个月创建MySQL中EnWikipedia数据库的表中的索引之后。现在
,我已经达到了“pagelinks”创建索引的点。
然而,它似乎把无限的时间通过这一点。
因此,我检查了剩下的传递,以确保我的直觉是正确与否的时间。
结果,预计剩余时间为60天(假设我在“pagelinks”从一开始就创建索引一次。)
My EnWikipedia database has 7 tables:
"categorylinks"(records: 60 mil, size: 23.5 GiB),
"langlinks"(records: 15 mil, size: 1.5 GiB),
"page"(records: 26 mil, size 4.9 GiB),
"pagelinks"(records: 630 mil, size: 56.4 GiB),
"redirect"(records: 6 mil, size: 327.8 MiB),
"revision"(records: 26 mil, size: 4.6 GiB) and "text"(records: 26 mil, size: 60.8 GiB).
我的服务器是... 版本的Linux 2.6.32 -5- AMD64(Debian的2.6.32-39),16GB内存,2.39Ghz英特尔4核心
那是用于创建指数普遍现象采取这么长的日子吗? 有没有人有更好的解决方案来更快地创建索引?
在此先感谢!
P.S:我做了以下操作来检查剩余时间。
引用(对不起,下页是用日语):http://d.hatena.ne.jp/sh2/20110615
1日。我在“pagelink”中获得了记录。
mysql> select count(*) from pagelinks;
+-----------+
| count(*) |
+-----------+
| 632047759 |
+-----------+
1 row in set (1 hour 25 min 26.18 sec)
第二。我得到了每分钟增加的记录数量。
getHandler_write.sh
#!/bin/bash
while true
do
cat <<_EOF_
SHOW GLOBAL STATUS LIKE 'Handler_write';
_EOF_
sleep 60
done | mysql -u root -p -N
命令
$ sh getHandler_write.sh
Enter password:
Handler_write 1289808074
Handler_write 1289814597
Handler_write 1289822748
Handler_write 1289829789
Handler_write 1289836322
Handler_write 1289844916
Handler_write 1289852226
第三。我计算了录音的速度。
据2的结果,记录的速度为
7233 records/minutes
第四。然后,剩余时间为
(632047759/7233)/60/24 = 60 days
这些都是相当大的表,所以我期望的索引是相当缓慢的。 6,300万条记录是很多索引数据。有一点需要注意的是分区,数据集很大,没有正确分区的表,性能会很低。下面是一些有用的链接: using partioning on slow indexes你也可以尝试寻找建立索引缓冲区的大小设置(默认为8MB,做那将公平一点你慢下来,你的大表buffer size documentation
谢谢你的建议,我会检查我的设置。 – 2012-04-12 14:15:12
的可能重复HTTP ://stackoverflow.com/questions/2167522/innodb-takes-over-an-hour-to-import-600mb-file-myisam-in-a-few-minutes – SunKing2 2012-04-12 10:16:45
现在,这就是我所说的耐心。尊重。 – fancyPants 2012-04-12 10:56:23