MySQL查询以减少服务器负载 [英] MySQL query to reduce server load

查看:42
本文介绍了MySQL查询以减少服务器负载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MySQL 服务器正在运行,它将通过 php 前端定期查询.我有点担心服务器负载,因为会有相当多的人访问网页,每个会话都会定期查询数据库.查询结果,本质上网页对所有用户都是一样的.

I have a MySQL server running that will be queried regularly through a php front end. I'm slightly worried about server load as there will be a fair amount of people accessing the webpage, with each session querying the database regularly. The results of the query, and in essence the webpage will be the same for all users.

有没有办法查询一次数据库,然后将数据/结果输出到网页,所有用户都可以从该网页连接并查看?基本上是为所有连接到网页的用户运行查询,而不是每个用户都查询数据库.

Is there a way of querying the database once, and outputting the data/results to the webpage, from which all users connect to and view? Basically running the query for all users that connect to the webpage, rather than each user querying the database.

任何建议表示赞赏.

谢谢

推荐答案

您不必担心.
用于此目的的数据库.

You don't have to worry.
Databases intended for that.

世界上大多数站点的运行方式完全相同:运行的 MySQL 服务器将通过 php 前端定期查询.没什么不好的.

Most sites in the world run exactly the same way: MySQL server running that will be queried regularly through a php front end. Nothing bad with it.

经过良好调整的 SQL 服务器和设计合理的查询将提供比您想象的更多的服务.您将需要非常高的流量才能开始担心这些事情.
不要忘记 MySQL 有自己的查询缓存.

Well tuned SQL server and properly designed query will serve much more than you think. You will need exceptionally high traffic to start worrying about such things.
Don't forget that MysQL has it's own query cache.

另请注意,没有用户连接"到该网页.他们连接,获取页面内容并断开连接.

Also please note that there are no users "connected" to the webpage. They connect, get page contents and disconnect.

这篇关于MySQL查询以减少服务器负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆