사용자 도구

사이트 도구


database:seek_method

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
마지막 판 양쪽 다음 판
database:seek_method [2022/03/30 22:21]
kwon37xi
database:seek_method [2023/05/31 13:27]
kwon37xi [seek method]
줄 1: 줄 1:
 ====== seek method ====== ====== seek method ======
 +  * 명칭이 명확하지 않음.
 +  * seek method, keyset pagination 등으로 불리는 듯.
 +
  
 ===== offset/limit 기반 페이징의 문제점 ===== ===== offset/limit 기반 페이징의 문제점 =====
줄 6: 줄 9:
     * 데이터 추가시 :  그 뒷 페이지에서 앞선 조회에서 나왔던 데이터가 새로 추가된 데이터로 인해 뒤로 밀리면서 뒷편 페이징에서 다시 출현하게됨.     * 데이터 추가시 :  그 뒷 페이지에서 앞선 조회에서 나왔던 데이터가 새로 추가된 데이터로 인해 뒤로 밀리면서 뒷편 페이징에서 다시 출현하게됨.
     * 데이터 삭제시 : 이번 페이지에서 맨 앞부분에 조회되었어야할 데이터가 앞 선 페이지에서의 데이터 삭제로 바로 앞 페이지 쪽으로 이동하면서 조회가 안되고 누락되는 현상 발생.      * 데이터 삭제시 : 이번 페이지에서 맨 앞부분에 조회되었어야할 데이터가 앞 선 페이지에서의 데이터 삭제로 바로 앞 페이지 쪽으로 이동하면서 조회가 안되고 누락되는 현상 발생. 
- +  * 거기에다 ''totalCount''까지 매번 세개 되면 성능저하가 더 커지게 된다.
 ===== seek method ===== ===== seek method =====
   * 이를 해결하려면 PK id 값으로 정렬을 하고(보통은 ''asc'', DB 자체 기본 PK 정렬을 사용)   * 이를 해결하려면 PK id 값으로 정렬을 하고(보통은 ''asc'', DB 자체 기본 PK 정렬을 사용)
줄 50: 줄 52:
   * [[https://www.eversql.com/faster-pagination-in-mysql-why-order-by-with-limit-and-offset-is-slow/|Why Order By With Limit and Offset is Slow - Faster Pagination in Mysql]]   * [[https://www.eversql.com/faster-pagination-in-mysql-why-order-by-with-limit-and-offset-is-slow/|Why Order By With Limit and Offset is Slow - Faster Pagination in Mysql]]
   * [[https://use-the-index-luke.com/sql/partial-results/fetch-next-page|OFFSET is bad for skipping previous rows]]   * [[https://use-the-index-luke.com/sql/partial-results/fetch-next-page|OFFSET is bad for skipping previous rows]]
 +  * [[https://use-the-index-luke.com/no-offset|We need tool support for keyset pagination]]
   * [[https://blog.jooq.org/faster-sql-paging-with-jooq-using-the-seek-method/|Faster SQL Pagination with jOOQ Using the Seek Method – Java, SQL and jOOQ.]]   * [[https://blog.jooq.org/faster-sql-paging-with-jooq-using-the-seek-method/|Faster SQL Pagination with jOOQ Using the Seek Method – Java, SQL and jOOQ.]]
   * [[https://techblog.woowahan.com/2662/|Spring Batch와 Querydsl]] : ''min(PK),max(PK)''를 비교 조건에 넣어야 하는 이유.   * [[https://techblog.woowahan.com/2662/|Spring Batch와 Querydsl]] : ''min(PK),max(PK)''를 비교 조건에 넣어야 하는 이유.
   * [[https://vladmihalcea.com/sql-seek-keyset-pagination/|SQL Seek Method or Keyset Pagination - Vlad Mihalcea]]   * [[https://vladmihalcea.com/sql-seek-keyset-pagination/|SQL Seek Method or Keyset Pagination - Vlad Mihalcea]]
 +
database/seek_method.txt · 마지막으로 수정됨: 2023/05/31 13:27 저자 kwon37xi