分页大结果集的最佳方法是什么-Java [英] what is best way to paging big Resultset -Java

查看:24
本文介绍了分页大结果集的最佳方法是什么-Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找从性能角度来看的最佳方法,在网页上部分显示结果集,比如每页 10 个项目,如果用户想要查看更多结果,他按下一步"btn.我认为(可能是错误的)当按下下一步"按钮时,它应该是对服务器的新请求??

i am looking for best aproach from perfomance point of view , to show Resultset on webpage partially , lets say by 10 item per page and if user want to see more result, he pressing "next" btn . i think (probablly wrong) it should be new request to the Server when "Next" button is pressed ??

目前我正在学习 Java,GWT

currentlly i trying to learn Java,GWT

谢谢!

PS:对不起我的英语.

PS: sorry for my English.

推荐答案

答案取决于用户的行为:查看第 2 页、第 10 页或第 100 页的频率.

The answer would depend on your users' behavior: how often will the look at page 2, or page 10, or page 100.

如果他们很少看第 2 页,从不看第 10 页或第 100 页,那么重新提交请求可能没问题.

If they rarely look at page 2, and never look at page 10 or page 100, then resubmitting the request may be fine.

如果他们平时看第2页,经常看第10页,偶尔看第100页,那么部分缓存会很有用:缓存前100(或200,或300)个结果,只重新提交查询当他们超过这些结果时.我可能会将缓存存储在用户的会话中,但如果您的应用程序服务器是集群的,您必须考虑一下.

If they usually look at page 2, often look at page 10, and occasionally look at page 100, then a partial cache will be useful: cache the first 100 (or 200, or 300) results, and only resubmit the query when they go past those results. I would probably store the cache in the user's session, although you have to give that some thought if your application server is clustered.

如果他们总是翻阅每个结果?部分缓存仍然是答案,因为您不想在内存中存储大量数据.

And if they always page through every result? Partial caches are still the answer, because you don't want to store large chunks of data in-memory.

这篇关于分页大结果集的最佳方法是什么-Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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