每页最大SQL查询 [英] Maximum SQL Queries per page

查看:51
本文介绍了每页最大SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题可能没有确定的答案,因此,如果认为该问题是主观的,并且假设不好,请随时将其关闭.

This question probably has no definite answer, so if it's considered subjective and, let's say bad, please feel free to close it.

基本上,我正在开发一个很大的Web应用程序(PHP),它使用 CakePHP .现在它正在开发中,数据库中的某些事情确实很复杂,因此需要进行很多查询才能显示页面(大约7-25个查询).

Basically I am developing a pretty big web application (PHP), and it uses CakePHP. Right now it's under development and some things in the Database are really complex therefore lots of queries need to be made in order to display the pages (around 7-25 queries).

由于这可能会是一个大规模的会议,所以我想知道什么是 maximum ,即某种意义上的点表明您可能正在做某事错误并应进行优化",即每页应执行的SQL查询数.我现在建立了一个非常简单的缓存系统,该系统将单个用户运行的查询减少到15个左右的5个左右.

Since this is probably going to be a large-scale one, I would like to know what's the maximum, that is, sort-of a point that indicates that "You're probably doing something wrong and should optimize", number of SQL queries that should be done per page. I have a very simple caching system set up right now which reduces the queries ran by a single user to around 5 for 15 seconds.

经常运行25个查询吗?我是否应该暂时停止开发(我有足够的时间)并重构代码,删除未使用的SQL查询,并花一些时间来提高这部分的性能?

Is running 25 queries a lot? Should I stop the development (I have plenty of time) for a while and refactor the code, remove SQL Queries that are not used, and dedicate time to improve performance on this part?

这听起来似乎有些混乱,所以请继续进行:是否对每个不会影响服务器的页面(即共享托管环境)运行的查询数量有一个事实最大值?

This probably sounds a little confusing, so resumed: Is there a de facto maximum for the number of queries ran per page that does not hammer a server (that is, a shared hosting environment)?

谢谢.

推荐答案

数据库的命中总数也与页面浏览量成正比.因此,如果页面浏览量*每页查询量大于数据库的容量,那么您就会遇到问题.显然,站点之间的流量变化很大,数据库容量也有很大的不同,因此确实没有针对的数字.

The total number of hits to your database is also proportional to the number of page views. So if page views * queries per page is more than the capacity of your database, then you've got a problem. Obviously traffic varies very widely from site to site, as does database capacity, so there really can't be a number to aim for.

这篇关于每页最大SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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