通过创建静态页面来减少 mysql 的工作?
假设我的数据库中有 3 个表,具有相同的主 ID 号和 15 个属性(每个表 5 个)。我在 table_1 中进行查询,其中 property_1="something",我获取 id,然后用 echo 和 html 打印它们的所有属性。(有更好的方法吗?)假设我达到了某个时间,例如 10000每个 id 有 15 个属性(我将使用正确的分页)。这会增加很多加载页面时间吗? (我将使用共享主机)如果是,是否可以创建按时间间隔刷新其内容的静态页面?
(这是我的第一个 php-mysql 网站,如有帮助,不胜感激)
lets say i have 3 tables in my database, with the same primary id number and 15 properties (5 for each table). I do a query in table_1 where property_1="something",i take the id's and i print all their properties with echo and html.(Is there a better way?) let's say i reach some time that i'll take for example 10000 id's with 15 properties each(and i'll use a correct pagination). Will this increase a lot the load page time? (i'll use shared hosting) If yes is it possible to create static page that refresh their content in time intervals?
(this is my first php-mysql site any help is appreciated)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果要查询多个表,应该使用 join
If you want to query multiple tables, you should use a join
如果您使用分页,则不会有任何问题,因为 MySql 有
Limit
关键字,可以让您跳过一些行并获取特定数量的行。这将减少查询返回的值集。If you use pagination you won't have any problem because MySql has
Limit
keyword that let you skip some rows and take a specific number of rows. This will reduce the set of value returned by the query.假设您有适当的索引,10000 个表是相当小的。
当然,这取决于访问者的数量,如果每分钟有数千次点击,添加缓存会有所帮助。
Assuming that you have proper indexes, 10000 is pretty small table.
Of course, it depends of number of visitors, if you have thousands of hits per minute, adding cache will help.