웹마스터 팁
최신 댓글 보여주는 기능에 관련해
2009.12.11 09:42
최신 댓글을 보여주는 모듈이 DB engine이 MyISAM인 경우
의도한대로 idx_list_order 타지 않는 문제가 있어서 사이트가 커질 수록 병목지점이 되는 문제점이 발생하고 있습니다.
select * from `xe_comments` as comments
where (module_srl in (189,187,170927,254697,345,201,199,150520,3094,193129,575794,56544,198,195,104799,200,194,274031,208,191,193,326,528774,527420,192,922,190,207,204,206,59798,205,202,577,196))
and list_order < 2100000000
order by list_order asc limit 5;
이를 해결하기 위해서 DB type이 MyISAM인 경우, use index 를 이용해서 idx_list_order를 강제적으로 쓰게
소스를 수정해 주셔야 할 것으로 보입니다.
select * from `xe_comments` as comments
use index (idx_list_order)
where (module_srl in (189,187,170927,254697,345,201,199,150520,3094,193129,575794,56544,198,195,104799,200,194,274031,208,191,193,326,528774,527420,192,922,190,207,204,206,59798,205,202,577,196))
and list_order < 2100000000
order by list_order asc limit 5;