개발 나누고 더하기/DB
-
호텔 상세 페이지 성능 개선 경험 : DB 데이터 패치 크기를 줄이자개발 나누고 더하기/DB 2023. 3. 3. 23:05
1년 전 간단한 쿼리 수정으로 호텔 상세 정보 조회 API 응답속도를 15% 가량 개선한 적이 있다. APM으로 핀포인트를 쓰는데 아래와 같이 API에서의 메서드별 처리시간이 나온다. 어디서 시간이 오래 걸리는지 병목지점을 찾기 위해 봤는데, 아래와 같이 단순한 쿼리가 전체 응답시간의 60%정도를 차지하고 있었다. SELECT ha.hotel_id, a.name, ha.is_using FROM hotel_amenity ha JOIN amenity a ON ha.amenity_id = a.id WHERE hotel_id = 77; 아주 단순한 쿼리이고, 해당 쿼리를 가져와 실행계획을 보면 인덱스도 잘 타는 것을 확인할 수 있다. 일단 여기까지 중간 정리하면, 호텔에는 아기 침대, 피트니스, 사우나 등 해당..