MySQL数据库在什么时候开始失去性能?
物理数据库大小重要吗? 记录的数量重要吗? 性能下降是线性的还是指数级的?
我有一个我相信是一个大的数据库,大约有1500万条记录,占用了近2GB。基于这些数字,我是否有任何动机清理数据,或者我是否可以允许它继续扩展几年?
MySQL数据库在什么时候开始失去性能?
物理数据库大小重要吗? 记录的数量重要吗? 性能下降是线性的还是指数级的?
我有一个我相信是一个大的数据库,大约有1500万条记录,占用了近2GB。基于这些数字,我是否有任何动机清理数据,或者我是否可以允许它继续扩展几年?
当前回答
如果数据库设计不当,性能可能会在几千行中下降。
如果你有合适的索引,使用合适的引擎(不要使用MyISAM,因为需要多个dml),使用分区,根据使用情况分配正确的内存,当然还有良好的服务器配置,MySQL可以处理tb级的数据!
总有办法提高数据库性能。
其他回答
2GB和约15M条记录是一个非常小的数据库-我在奔腾III上运行过更大的数据库(!),一切仍然运行得非常快。如果你的慢,那是数据库/应用程序设计的问题,而不是mysql的问题。
我将首先关注您的索引,然后让服务器管理员查看您的操作系统,如果所有这些都没有帮助,可能是时候进行主/从配置了。
这是真的。另一个通常有效的方法是减少重复处理的数据量。如果你有“旧数据”和“新数据”,并且99%的查询都使用新数据,只需将所有旧数据移动到另一个表中-并且不要查看它;)
->看看分区。
The database size does matter. If you have more than one table with more than a million records, then performance starts indeed to degrade. The number of records does of course affect the performance: MySQL can be slow with large tables. If you hit one million records you will get performance problems if the indices are not set right (for example no indices for fields in "WHERE statements" or "ON conditions" in joins). If you hit 10 million records, you will start to get performance problems even if you have all your indices right. Hardware upgrades - adding more memory and more processor power, especially memory - often help to reduce the most severe problems by increasing the performance again, at least to a certain degree. For example 37 signals went from 32 GB RAM to 128GB of RAM for the Basecamp database server.
I once was called upon to look at a mysql that had "stopped working". I discovered that the DB files were residing on a Network Appliance filer mounted with NFS2 and with a maximum file size of 2GB. And sure enough, the table that had stopped accepting transactions was exactly 2GB on disk. But with regards to the performance curve I'm told that it was working like a champ right up until it didn't work at all! This experience always serves for me as a nice reminder that there're always dimensions above and below the one you naturally suspect.
不,这并不重要。MySQL的速度大约是每秒700万行。所以你可以把它放大一点