제가 쓰는 쿼리가 <div><br></div> <div>select </div> <div>b.idx as idx,</div> <div><div>(select CONCAT(attach_path,'/',attach_savename) from g_attach </div> <div> where b.board_category=board_id and b.idx = board_idx order by attach_idx asc limit 0, 1) as att_file1,</div> <div>(select CONCAT(attach_path,'/',attach_savename) from g_attach </div> <div> where b.board_category=board_id and b.idx = board_idx order by attach_idx asc limit 1, 1) as att_file2,</div> <div>(select CONCAT(attach_path,'/',attach_savename) from g_attach </div> <div> where b.board_category=board_id and b.idx = board_idx order by attach_idx asc limit 2, 1) as att_file3,</div> <div>(select CONCAT(attach_path,'/',attach_savename) from g_attach </div> <div> where b.board_category=board_id and b.idx = board_idx order by attach_idx asc limit 3, 1) as att_file4,</div> <div>(select CONCAT(attach_path,'/',attach_savename) from g_attach </div> <div> where b.board_category=board_id and b.idx = board_idx order by attach_idx asc limit 4, 1) as att_file5,</div> <div>(select CONCAT(attach_path,'/',attach_savename) from g_attach </div> <div> where b.board_category=board_id and b.idx = board_idx order by attach_idx asc limit 5, 1) as att_file6</div></div> <div>from g_board as b</div> <div><br></div> <div>이런 코드를 짠게 있습니다.</div> <div>대략적으로 일단 제가 질문드릴 부분만 추린건데요</div> <div>g_board 테이블에 게시물이 있고</div> <div>g_attach 테이블에 첨부된 파일이 들어있습니다.</div> <div>한 게시물당 첨부는 6개 까지 가능하고 첨부를 안할수도 있고 1~5개만 첨부를 할수도 있습니다.</div> <div>저런식으로 해서 리스트를 뿌려주는데 </div> <div>저게 결국 select 를 7번이나 하는 격이 되서 쿼리문 자체 실행속도가 매우 느립니다.</div> <div>저 쿼리문의 실행속도를 빠르게 쿼리 수정이 혹시 가능 할까 해서 여기에 질문글을 올립니다.</div> <div>참고로 DB는 MySql을 쓰고 있습니다. </div> <div>도와주세요..ㅠㅠ</div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.