슬로우쿼리 질문좀요.. ㅠㅠ

슬로우쿼리 질문좀요.. ㅠㅠ

QA

슬로우쿼리 질문좀요.. ㅠㅠ

답변 3

본문

안녕하세요.
카페24 호스팅입니다.


유선상으로 안내드렸습니다.

 

고객님의 oopsparty4 계정의 DB의 쿼리에서 sending data가 빈번해 테이블 락이 발생하고있습니다.

이에 따라 DB 부하가 생겨 다른사용자에게까지 간섭이 발생하고있습니다.

 

아래 쿼리에 대해 수정해보시기 바랍니다.

# User@Host: oopsparty4[oopsparty4] @ localhost []

# Thread_id: 66783  Schema: oopsparty4  Last_errno: 0  Killed: 0

# Query_time: 11.042988  Lock_time: 5.956752  Rows_sent: 2  Rows_examined: 1045471  Rows_affected: 0  Rows_read: 2

# Bytes_sent: 1983  Tmp_tables: 0  Tmp_disk_tables: 0  Tmp_table_sizes: 0

SET timestamp=1497851472;

select *  from g5_board_new where wr_parent = wr_id  and find_in_set(bo_table, ''notice,info'')   and as_list in (''1'',''3'')   order by  bn_id desc limit 0, 2;

 

관련하여 14시부터 현재까지 발생한 슬로우쿼리에 대해

고객님 ftp최상위 디렉토리에 oopsparty4_20170619_slow.log 파일명으로 올려드렸으니 확인 해보시기 바랍니다.

--------------------------------------------------------

위 내용이 카페24에서 온 답변인데요.. 슬로루 쿼리 정보나 해결 법 좀 문의 드려요.

 

그누보드 영카드 아미나 빌드 사용 하고 있어요. 접속자는 지금 100명 정도 인데 느려졌어요 ㅠㅠ

 

 

 

이 질문에 댓글 쓰기 :

답변 3

select *  from g5_board_new where wr_parent = wr_id  and find_in_set(bo_table, ''notice,info'')   and as_list in (''1'',''3'') &nbs! p; order by  bn_id desc limit 0, 2;

 

해당 쿼리와 g5_board_new 인덱싱를 개선해야 할것으로 보입니다.

 

6초, 11초 걸리네요

 

explain {query} 하여 쿼리의 인덱싱 상태를 확인후 개선해나가세요.


아..감사합니다만 더 쉽게 설명해주실수 있나요?? ㅠㅠ 관련자료를 찾아보고 있는데.. 제 수준이 너무 낮아서 그런지 이해가 힘들어서요..
 
select *  from g5_board_new where wr_parent = wr_id  and find_in_set(bo_table, ''notice,info'')  and as_list in (''1'',''3'') &nbs! p; order by  bn_id desc limit 0, 2;
 
요부분을 찾아서 고치면 되는건가용 ?

select 쿼리문에 따라, 해당 테이블의 인덱스를 재설정 하시거나 추가해 보세요.  

 

 

 

explain(select *  from g5_board_new where wr_parent = wr_id  and find_in_set(bo_table, ''notice,info'')   and as_list in (''1'',''3'') order by  bn_id desc limit 0, 2);

 

이렇게 쿼리를 실행하면 결과값을 주고 해당 구글검색결과로 보시면 됩니다. 

 

https://www.google.co.kr/#q=mysql+explain+%EB%B3%B4%EB%8A%94+%EB%B2%95&spf=1497856066822

 

이렇게 하면 인덱스를 타지 않는 이유를 알수 있지만 해결책은 인덱스가 잡힌거에 따라

 

다르기 때문에 딱히 이거라고 설명을 드릴수가 없을거 같네요. 

답변을 작성하시기 전에 로그인 해주세요.
전체 4
© SIRSOFT
현재 페이지 제일 처음으로