티스토리 뷰

/**
 * Set's LIMIT - maximum number of rows to be selected.
 * NOTE that it may not work as you expect if you are using joins.
 * If you want to implement pagination, and you are having join in your query,
 * then use instead take method instead.
 */
limit(limit?: number): this;

/**
 * Set's OFFSET - selection offset.
 * NOTE that it may not work as you expect if you are using joins.
 * If you want to implement pagination, and you are having join in your query,
 * then use instead skip method instead.
 */
offset(offset?: number): this;

/**
 * Sets maximal number of entities to take.
 */
take(take?: number): this;

/**
 * Sets number of entities to skip.
 */
skip(skip?: number): this;

 

공통점

  • limit와 take : 불러오는 콘텐츠 개수
  • offset과 skip : 몇 번째 콘텐츠부터 출력할지

 

차이점

  • limit와 offset : join하기 전에 실행 - row 기준, join 했을 때 join을 한 모든 테이블의 row에 적용된다
    - user 테이블에 post를 join하고 limit 5를 적용했다면
    : user만 5개 불러와지는 게 아니라 join된 post의 row도 5개까지만 불러온다.
  • take와 skip : join 후에 실행 - entity 기준
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함