목록전체 글 (19)
co-cherry
페이징게시글 목록 조회 API를 구현하면 이와 같은 형태로 작성하게 된다. List posts = postRepository.findAll(); 로컬에서 데이터 10개 정도로 테스트할 때는 문제 없이 잘 동작하지만, 게시글이 10,000개 정도 있다고 가정해보자. 이 API를 호출하는 순간,데이터베이스는 10,000개의 행을 읽어서 메모리에 올린다애플리케이션은 10,000개의 Post 객체를 생성한다네트워크를 통해 수 MB의 JSON 데이터가 전송된다프론트엔드는 10,000개의 게시글을 한꺼번에 렌더링하려 시도한다우리의 서버 메모리는 낭비되고 응답은 느려지며 멈춘 듯한 화면을 보게 될 것이다. 이 문제에 대한 해결책이 Paging이다. '한번에 모든 데이터를 보여 줄 필요가 없다면 필요한 만큼만 잘라서..
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AZz7FPpqAUnHBIRj&categoryId=AZz7FPpqAUnHBIRj&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=&pageSize=10&pageIndex=1 SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.comT = int(input())for _ in range(T): N = int(input()) costs = list(map(int, input()..
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWHPkqBqAEsDFAUn SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.comT = int(input())for test_case in range(1, T + 1): n = int(input()) scores = list(map(int, input().split())) possible = {0} for score in scores: new_scores = set() for prev_score in..
