Skip to content

Board Service - getNoticeItems, getItems Method 에서 발생하는 n+1 문제를 해결합니다. #327

@xharpenParksuhyeon

Description

@xharpenParksuhyeon

getNoticeItems, getNoticeItems Method 에서 발생하는 User 모델에 대한 n+1 문제을 해결해줍니니다.


with 을 사용하지 않는 상태….

페이지 Execute Query Count: Memory Usage Request Duration Query Duration
게시판 Show 페이지 57 12MB 132ms 21.57ms

져온 게시물 갯수만큼 해당 쿼리가 추가로 실행되고 있습니다.

select * from `xe_user` where `xe_user`.`id` = '' and `xe_user`.`id` is not null limit

with 을 사용한 상태…

페이지 Execute Query Count: Memory Usage Request Duration Query Duration
게시판 Show 페이지 49 12MB 128ms 18.24ms

with 구문을 사용해 user 모델애 대한 n + 1 문제를 해결했습니다.

select * from `xe_user` where `xe_user`.`id` in ('게시판 아이디 ...')

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions