简体   繁体   English

从Linux 64位到Windows 32位的MySql-查询速度慢?

[英]MySql from Linux 64bit to Windows 32Bit - Slow queries?

We have a database that was backed up from a Linux 64 bit version of MySql that we have restored onto a Windows 32bit version of MySql. 我们有一个从Linux 64位版本的MySql备份的数据库,该数据库已还原到Windows 32位版本的MySql。

We have a table with about 4.5 gig of data - the main space being consumed by a BLOB field containing file data. 我们有一个包含约4.5 gig数据的表-主空间被包含文件数据的BLOB字段占用。 The table itself only has about 6400 records in it. 该表本身仅包含约6400条记录。

The following query executes on the Linux box in no time at all; 以下查询完全可以立即在Linux机器上执行; but on the windows box, it takes about 5 minutes to run and in the process, the server is unresponsive to anything else: 但是在Windows框上,它大约需要5分钟才能运行,在此过程中,服务器对其他任何内容均无响应:

select id from fileTable where cid=1234

Is there some sort of optimization we need to do? 我们需要做一些优化吗? Is there some sort of special considerations that need to be met when going from Linux to Windows or from 64 bit to 32 bit? 从Linux到Windows或从64位到32位时,是否需要满足一些特殊的考虑?

If you copied over the binary database files *.frm *.MYD *.MYI 如果复制二进制数据库文件* .frm * .MYD * .MYI

Then you should check this out: http://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html 然后您应该检查一下: http : //dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html

If you exported the DBs content then: 如果导出数据库内容,则:

Check the version numbers and changelogs. 检查版本号和变更日志。

Also consider if there are performance differences between the two systems! 还请考虑两个系统之间是否存在性能差异! (maybe this is normal) (也许这很正常)

I'd say the 4.5 Gig of data will be easier accessible via a 64bit number space (which has a upper limit of 17.2 gigabyte in directly addressable memory). 我想说,通过64位数字空间(可直接寻址的内存上限为17.2 GB)将更易于访问4.5 Gig数据。 32 bit addressable memory is 4Gb, so if your database is bigger than this then possibly MySQL cannot handle the indexing as quickly. 32位可寻址内存为4Gb,因此,如果您的数据库大于此值,则MySQL可能无法尽快处理索引。

Is there a way of re-indexing or optimising your database so that its paged in a more 32bit friendly way? 有没有一种方法可以重新索引或优化数据库,以便以更友好的32位方式分页? Altering the largest table to a different storage engine may do this (use ALTER or phpMyAdmin). 将最大的表更改为其他存储引擎可能会这样做(使用ALTER或phpMyAdmin)。

You may also have lost some indexing on the ID field after the move. 移动之后,您可能还丢失了一些在ID字段上的索引。 try running your select again, with EXPLAIN at the front; 尝试再次运行您的选择,前面有EXPLAIN;

EXPLAIN select id from filetable where cid=1234 从cid = 1234的文件表中选择选择ID

if the table produced after the query contains mosty NULLs then you need to re-configure the keys in your table. 如果查询后生成的表包含大多数NULL,则需要重新配置表中的键。

Alternatively, check how much RAM is on your 32bit box, is it comparable to the 64 bit box? 另外,请检查您的32位设备上有多少RAM,它可媲美64位设备吗?

Obviously, back it all up and do tests on a non-live server first ;) 显然,将其全部备份并首先在非活动服务器上进行测试;)

I hope this helps you get on the right track. 我希望这可以帮助您走上正确的道路。

只需对所有表进行优化,然后检查(仍然)cid上的索引。

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

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