简体   繁体   English

MySQL:大量数据

[英]MySQL: large amount of data

first of all let me try to describe my problem. 首先让我尝试描述我的问题。 Client is using application for a single year and he stored about 7 milions records into mysql database. 客户正在使用应用程序一年,他将大约700万条记录存储到mysql数据库中。 His plan is to continue working even more on this application but it slows down with this amount of data. 他的计划是继续在该应用程序上做更多的工作,但是由于这种数据量而减慢了速度。

Of course, the question is what will happend in next year, two or five... 当然,问题是明年会发生两到五年...

This is pretty specific case where ~98% of data is stored in one single relational table (it is link between 2 tables). 这是非常特定的情况,其中〜98%的数据存储在一个单独的关系表中(它是2个表之间的链接)。

What is the "best" solution in this case? 在这种情况下,“最佳”解决方案是什么? Best includes safe, well designed, the most logical solution which make the app usable for a long time and prevents this situation. Best包括安全,精心设计,最合乎逻辑的解决方案,这些解决方案使该应用程序可以长期使用,并可以防止这种情况的发生。

My toughts: keep current table as a history table and create a new one where I can store records for last 3 months and do some movements when records get old? 我的强项:将当前表保留为历史记录表,并创建一个新表,可以在其中存储最近3个月的记录,并在记录变旧时进行一些移动?

Respect! 尊重!

For a many:many mapping table, use the tips described here: http://mysql.rjweb.org/doc.php/index_cookbook_mysql#many_to_many_mapping_table . 对于多对多映射表,请使用此处描述的提示: http : //mysql.rjweb.org/doc.php/index_cookbook_mysql#many_to_many_mapping_table That will improve performance in many situations. 在许多情况下,这将提高性能。

Please provide SHOW CREATE TABLE and the SELECTs that are slowing down. 请提供SHOW CREATE TABLE和正在变慢的SELECTs

If that much of the data is in the 'link' table, how do the queries differ from a CROSS JOIN ? 如果有很多数据在“链接”表中,则查询与CROSS JOIN有何不同?

Partitioning rarely improves performance. 分区很少会提高性能。 Again, need to see the queries. 再次,需要查看查询。 MERGE is a MyISAM-based pre-PARTITION kludge. MERGE是基于MyISAM的pre-PARTITION混合器。 Do not use it. 不要使用它。

History table? 历史记录表? Do the queries look for the "latest" of something? 查询是否寻找事物的“最新”? Again, need to see the schema and queries. 再次,需要查看架构和查询。

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

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