mysql优化
我正在运营一个网站,并且在该网站上吸引了很多用户。现在我面临的问题是传入和传出消息只有一个表。当这个消息表的大小达到200万以上时,网站就会变得非常慢。
请告诉我这个问题的解决方案是什么?
我的网站是 发送短信到巴基斯坦
我的服务器配置是 1 GB 内存 786GHz 处理器 200 GB 硬盘
I am running a website and I have reached a lot of users on the website. Now the issue that I am facing is that there is a single table for incoming and outgoing messages. When the size of this table of messages reaches more than two million, the website becomes very slow.
Please tell me what is the solution of this problem?
my website is send sms to pakistan
my server configuration is 1 gb ram
786 ghz processor
200 gb hard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有一种万能的解决方案可以修复数据库。分片可能会有所帮助,但对于大约 200 万个左右,我预计问题主要是查询写得不好和缺乏索引。使用 EXPLAIN 和查询分析器找出您的数据库正在做什么,然后对其添加一些索引。升级到 1 或 2ghz 的服务器也是获得更好速度的相对便宜的方法。
There is no one size-fits-all solution to fixing your database. Sharding could help, but for just 2 million or so I would expect the issue to be mostly poorly written queries and a lack of indexes. Use EXPLAIN and the query analyzer to figure out what your DB is doing and then throw some indexes on it. Upgrading to a server with 1 or 2ghz would also be a relatively cheap way to get better speed.
您可能会受益于向表中添加索引,并确保您的查询正确使用这些索引。
优化 MySQL:查询和索引< /a> 是一篇很好的文章,涵盖了基础知识和其他可以用来分析站点缓慢查询的操作。
You could probably benefit from adding indexes to your tables and be sure your queries are using those appropriately.
Optimizing MySQL: Queries and Indexes is a good article covering the basics and other things you can do to analyze the slow queries of your site.