开发者

Search engine logic with pagination, working with large result set

i've got a website with internal search engine that searches for users with specific parameters like age, height.... There are thousands of users so i've decided to use advanced CTE in order to retrieve 10 records each time to reduce load on MSSQL server.

In this CTE i get results by pages (ie. 10 records per page) while ordering it by lastVisit of user.

Problem is that i can't use default asp.net built it pager control so i've made mine which works fine but i need to get amount of pages in whole result set each time search is generated thus i first get result set and then max number of records so i can divide it by 10 to get latest page number to use in my pager controller.

so each time page loads two db calls are made, while i want to avoid 开发者_运维知识库needless amount of records when user just switches a page with same search parameters.

How would you advice to do that ?


Cache the total number of results, e.g. by assigning some (user-dependent) token and passing it back to server when user is paging? You may also cache the result set itself this way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜