简体   繁体   English

优化 MySQL 大表

[英]Optimize big MySQL table

I have MYISAM table with 60 000 000 rows.我有 60 000 000 行的 MYISAM 表。 It has a lot of INSERTS and some SELECTS (not UPDATEs).它有很多 INSERTS 和一些 SELECTS(不是 UPDATE)。

Executed INSERTs blocks reads (its obviously).执行的插入块读取(很明显)。

I only read 1% of rows, other 99% rows will be never reads.我只读取了 1% 的行,其他 99% 的行将永远不会被读取。

I want optimize this.我想优化这个。 I think is good way to create duplicate table only for SELECTs with popular rows.我认为是仅为具有流行行的 SELECT 创建重复表的好方法。

Is any ready solution for this?有什么现成的解决方案吗? I'm working at PHP+MySQL.我在 PHP+MySQL 工作。

Use a cronjob to INSERT...SELECT and DELETE inactive rows in your table to another table, if you have a way to locate those inactive rows, eg if those rows have a certain range of timestamp.使用 cronjob 将表中的INSERT...SELECTDELETE非活动行INSERT...SELECT另一个表,如果您有办法定位那些非活动行,例如,如果这些行具有特定范围的时间戳。 That gives you the ability to find out those rows while not affecting the performance of most other queries.这使您能够在不影响大多数其他查询的性能的情况下找出这些行。

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

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