2019년 5월 27일 월요일

spring mongodb Sort시 에러.

spring mongodb Sort시에 아래와 같은 에러가 발생한다.

Query failed with error code 96 and error message 'Executor error during find command :: caused by :: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.' on server localhost:27017

조회하려는 테이블이 log성 테이블이라 백만건이 넘어간다.
Sort 하려는 필드는 lastUpdated 이다. 해당 필드를 index에 추가 해서 해결했다.
index 추가하는 건 compass로 접속 해서 collection 선택하면 나오는 index 탭에서 쉽게 할 수 있다.

근데, compass에서는 index 설정을 안해도 잘 된다. 어떻게 되는 건지 모르겠다.

댓글 없음:

댓글 쓰기