Q&A

라이믹스에서 xml쿼리 사용시 force_index , use_index 사용가능한가요 ?

2025.02.02 04:00
76
0
CMS/프레임워크 Rhymix 2.1
개발 언어 PHP 8.4

<query id="getbinancecandlelog" action="select">

<tables>

<!-- idx_coin_candle_time 인덱스를 강제 지정 -->

<table name="gptcoin_binance_candle_log" index="idx_coin_candle_time" />

</tables>

<columns>

<column name="log_srl" />

<column name="close" />

<column name="rsi" />

<column name="timestamp" />

<column name="trend_index" />

<column name="trend_m" />

<column name="trend_9" />

<column name="trend_index9" />

</columns>

<conditions>

<!-- 인덱스가 (coin_srl, candle_type, timestamp) 형태라 가정하고, 동등조건을 먼저 둠 -->

<condition operation="equal" column="coin_srl" var="coin_srl" />

<condition operation="equal" column="candle_type" var="candle_type" pipe="and" />

 

<!-- timestamp 범위 (greater than, less than) → 인덱스 range scan 유도 -->

<condition operation="more" column="timestamp" var="start_date" pipe="and" />

<condition operation="less" column="timestamp" var="end_date" pipe="and" />

 

<!-- 필요 시 특정 timestamp 값도 equality로 체크 -->

<condition operation="equal" column="timestamp" var="timestamp" pipe="and" />

 

<!-- 그 외 검색 조건들 -->

<condition operation="equal" column="log_srl" var="log_srl" pipe="and" />

<condition operation="equal" column="purdate" var="purdate" pipe="and" />

</conditions>

<navigation>

<!-- 기존대로 정렬 기준이나 리스트 수 등은 자유롭게 지정 -->

<index var="sort_index" default="regdate" order="order_index" />

<list_count var="list_count" default="1400" />

</navigation>

</query>

 

 

이런식으로 쿼리를 짜보았는데, index를 타지 않더라구요. 

제가잘못알고 있는걸까요 ? 아니면 xml쿼리는 index 선택이 불가능한걸까요 ? 

댓글 2

  • 2025.02.02 06:55 #1857106
    XE 시절부터 지원해 온 index_hint 문법이 있습니다.

    https://github.com/rhymix/rhymix/blob/master/tests/_data/dbquery/indexHintTest1.xml
    https://github.com/rhymix/rhymix/blob/master/tests/_data/dbquery/indexHintTest2.xml
  • 2025.02.05 06:56 #1857629
    와 이런 방법이 정말 감사합니다.