Optimize query getCommentParentNextSibling

검색 조건에 document_srl을 넣지 않아서 인덱스를 타지 않는 문제 수정
(복합 인덱스의 첫 번째 컬럼이 검색 조건에 포함되어 있지 않으면 인덱스가 없는 것과 마찬가지임)
This commit is contained in:
Kijin Sung 2018-02-02 16:09:14 +09:00
parent 13ebfbfa8c
commit 23d074b486
2 changed files with 6 additions and 4 deletions

View file

@ -512,6 +512,7 @@ class commentController extends comment
{
// get the top listed comment among those in lower depth and same head with parent's.
$p_args = new stdClass();
$p_args->document_srl = $document_srl;
$p_args->head = $parent->head;
$p_args->arrange = $parent->arrange;
$p_args->depth = $parent->depth;

View file

@ -3,11 +3,12 @@
<table name="comments_list" />
</tables>
<columns>
<column name="min(comments_list.arrange)" alias="arrange" />
<column name="min(arrange)" alias="arrange" />
</columns>
<conditions>
<condition operation="equal" column="comments_list.head" var="head" filter="number" notnull="notnull" />
<condition operation="excess" column="comments_list.arrange" var="arrange" filter="number" notnull="notnull" pipe="and" />
<condition operation="less" column="comments_list.depth" var="depth" filter="number" notnull="notnull" pipe="and" />
<condition operation="equal" column="document_srl" var="document_srl" filter="number" />
<condition operation="equal" column="head" var="head" filter="number" notnull="notnull" pipe="and" />
<condition operation="excess" column="arrange" var="arrange" filter="number" notnull="notnull" pipe="and" />
<condition operation="less" column="depth" var="depth" filter="number" notnull="notnull" pipe="and" />
</conditions>
</query>