리스트에 자기가 댓글 단 글에 표시되게 하려면..? 속도 개선 방법부탁해요.. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

리스트에 자기가 댓글 단 글에 표시되게 하려면..? 속도 개선 방법부탁해요.. 정보

리스트에 자기가 댓글 단 글에 표시되게 하려면..? 속도 개선 방법부탁해요..

본문

게시판 리스트를 볼때 자기가 댓글을 써놓은 글 제목에만 옆에 특별한 아이콘을 붙여서  사용자가 확인하기가 용이하게 만들고 싶습니다.
 
list.php에서
 
while ($row = sql_fetch_array($result))
{
    // 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
    if ($sca || $stx)
        $row = sql_fetch(" select * from $write_table where wr_id = '$row[wr_parent]' ");
 
    $list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
//여기 추가..자기댓글 표시
        $row2 = sql_fetch(" select count(*) as cnt from $write_table where wr_parent = {$list[$i][wr_id]} and mb_id = '$member[mb_id]' and wr_id != wr_parent ");
        if($row2[cnt]>0) $list[$i][my]= 1;
//여기까지..

    if (strstr($sfl, "subject"))
        $list[$i][subject] = search_font($stx, $list[$i][subject]);
    $list[$i][is_notice] = false;
    //$list[$i][num] = number_format($total_count - ($page - 1) * $board[bo_page_rows] - $k);
    $list[$i][num] = $total_count - ($page - 1) * $board[bo_page_rows] - $k;
    $i++;
    $k++;
}
 
위처럼 해봤는데 속도가 엄청 느려지더군요..
 
게시글이 3만 여건 정도 되서요..
 
이리해보고 저리해보고 하다 안되서 글 올립니다..
 
속도를 개선 시킬 수 있는 방법 없을까요??
 
제 머리로는 한계가..;;
 
도움 좀 부탁드립니다..

댓글 전체

//여기 추가..자기댓글 표시
        $row2 = sql_fetch(" select count(*) as cnt from $write_table where wr_parent = {$list[$i][wr_id]} and mb_id = '$member[mb_id]' and wr_id != wr_parent ");
        if($row2[cnt]>0) $list[$i][my]= 1;
//여기까지..

where 조건이 index를 사용하지 않나 봅니다.


where wr_parent = {$list[$i][wr_id]}
and mb_id = '$member[mb_id]'
and wr_id != wr_parent ");

index 구성

PRIMARY            |            1 | wr_id        | A       
wr_num_reply_parent |            1 | wr_num        | A       
wr_num_reply_parent |            2 | wr_reply      | A       
wr_num_reply_parent |            3 | wr_parent    | A       
wr_is_comment      |            1 | wr_is_comment | A       
wr_is_comment      |            2 | wr_id        | A        |       

개선 방법

mb_id가 들어 가게 index를 추가해야 합니다.

alter table add index mb_id ( mb_id, wr_parent, wr_id);
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT