what is best way to paging big Resultset -Java

前端 未结 6 621
伪装坚强ぢ
伪装坚强ぢ 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:21

    You usually only get a "page" from the database.

    Let's say a query

    select * from mytable where column1="a";
    

    would give 1000 records. Then getting a page would be like (mysql):

    select * from mytable where column1="a" limit 0, 10;
    

    for page 1 (0 to 10), and page 2 would be retrieved like:

    select * from mytable where column1="a" limit 10, 20;
    

    and so forth. If the data is large (1000 records), but not huge ( 1000 000 records), you can also give the entire dataset at once and use javascript to page. That has the added advantage that sorting can be done client-side.

提交回复
热议问题