what is best way to paging big Resultset -Java

前端 未结 6 664
伪装坚强ぢ
伪装坚强ぢ 2021-01-19 06:44

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 p

6条回答
  •  不要未来只要你来
    2021-01-19 07:27

    If you can't use a cache-based approach due to memory limitations, use a query-based approach. Adjust the WHERE clause on your search query to explicitly select data based on which page the user has requested. This approach requires that you pass additional context information back and forth on your page requests.

    One approach is to fetch pages using logical Row IDs (or primary keys) that delimit the page and identify each row in the result set.

    Say you have a very simple table with a numerical sequence of row ids. If you are showing 100 rows per page, and the user has requested page two, you would adjust the WHERE clause as follows:

    select col, col2 from my_table where
    row_id > 100
    and row_id <= 200
    order by rownum asc
    

提交回复
热议问题