[CBRD-26524] Improving analytic function execution by reading only required rows#6901
[CBRD-26524] Improving analytic function execution by reading only required rows#6901Hamkua merged 11 commits intoCUBRID:developfrom
Conversation
|
Last reviewed commit: 226bc5c |
|
Last reviewed commit: dc48ba5 |
|
/run sql medium |
|
Last reviewed commit: c8bf449 |
|
Last reviewed commit: "코드 리뷰 반영" |
|
Reviews (5): Last reviewed commit: "Merge branch 'CUBRID:develop' into CBRD-..." | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
Reviews (9): Last reviewed commit: "Merge remote-tracking branch 'upstream/d..." | Re-trigger Greptile |
|
/run all |
|
/run all |
|
🗑️ TC Branch Finalized for Engine PR was closed (not merged). Cleanup Results: TC base branch is ready for the next PR. |
|
🗑️ TC Branch Finalized for Engine PR was closed (not merged). Cleanup Results: TC base branch is ready for the next PR. |
🧪 TC Test Environment ReadyCircleCI Testing:
TC Repositories & Branches:
Next Steps:
|
|
Reviews (10): Last reviewed commit: "Merge remote-tracking branch 'upstream/d..." | Re-trigger Greptile |
|
/run all |
|
✅ TC Branch Finalized for Engine PR was merged. Cleanup Results:
TC base branch is ready for the next PR. |
|
✅ TC Branch Finalized for Engine PR was merged. Cleanup Results:
TC base branch is ready for the next PR. |
… by reading only required rows (CUBRID#6901)
… by reading only required rows (CUBRID#6901)
…quired rows (CUBRID#6901) http://jira.cubrid.org/browse/CBRD-26524 Improve index-based sort queries to scan only the necessary amount of tuples. This optimization applies when the query's analytic functions consist only of: - ROW_NUMBER() - RANK() - DENSE_RANK() - FIRST_VALUE() (excluding IGNORE NULLS)
…quired rows (CUBRID#6901) http://jira.cubrid.org/browse/CBRD-26524 Improve index-based sort queries to scan only the necessary amount of tuples. This optimization applies when the query's analytic functions consist only of: - ROW_NUMBER() - RANK() - DENSE_RANK() - FIRST_VALUE() (excluding IGNORE NULLS)
http://jira.cubrid.org/browse/CBRD-26524
Purpose
큐브리드는 정렬이 필요한 분석함수가 있다면 테이블의 전체 행을 읽는 비효율이 있습니다.
인덱스를 활용하여 정렬을 생략할 수 있는 분석함수로만 구성된 쿼리는 전체 튜플을 스캔하지 않고 필요한 만큼만 스캔하도록 개선합니다.
LIMIT절 또는ROWNUM조건을 포함해야 합니다. (where rownum < 10,limit 10)PARTITION BY,ORDER BY) 인덱스의 선두 컬럼과 일치하여 정렬을 생략할 수 있어야 합니다.a_eval_list의 길이가 1 이어야 합니다.a_eval_list: 하나의 쿼리에 여러 분석 함수가 포함된 경우, 각 함수마다 매번 정렬한다면 효율이 낮아질 것입니다. CUBRID는 이러한 비효율을 줄이기 위해 동일한 정렬 기준(SORT_LIST)으로 처리 가능한 분석 함수들을 하나의 묶음으로 관리하는데, 이 묶음의 단위가 바로a_eval_list입니다.a_eval_list의 길이가 1이라는 것은 해당 쿼리 내 모든 분석 함수가 동일한 정렬 기준을 공유하며, 단 한 번의 정렬만으로 처리가 가능한 상태임을 의미합니다.대상 분석 함수 (
pt_check_analytic_limit_optimization()) :ROW_NUMBER()RANK()DENSE_RANK()FIRST_VALUE()(IGNORE NULLS제외)Implementation
정렬을 생략할 수 있고, limit 절 최적화가 가능하다면 processing 단계에서 instnum 을 평가하도록 수정
a_outptr_list_ex->valptrp에 instnum 함수를 삽입할 때, 순서가 잘못되는 문제를 함께 수정Remarks
N/A