简体   繁体   English

数据库内容加载优化

[英]Database content loading optimization

I am making a simple blog on react (nextjs) + redux.我正在制作一个关于 react (nextjs) + redux 的简单博客。 The main page contains a list of all articles.主页包含所有文章的列表。 The problem is that each query to the database with loading even a small number of articles takes time.问题在于,即使加载少量文章,对数据库的每次查询也需要时间。 How can this be optimized?如何优化? There is an idea to put these articles in redux on initial load.有一个想法是在初始加载时将这些文章放在 redux 中。 Is this a good idea?这是一个好主意吗? Or are there any better ways?或者有没有更好的方法?

One thing I will suggest is to have lazy loading.我会建议的一件事是延迟加载。 In this case, the app won't load every blog, and also you can just show the blog name and image and load the blog once someone wants to read it/ click it.在这种情况下,该应用程序不会加载每个博客,您也可以只显示博客名称和图像,并在有人想阅读/单击它时加载博客。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM