[CBRD-26475] hash join 실행계획을 옵티마이저가 선택#6782
Draft
shparkcubrid wants to merge 2 commits intoCUBRID:developfrom
Draft
[CBRD-26475] hash join 실행계획을 옵티마이저가 선택#6782shparkcubrid wants to merge 2 commits intoCUBRID:developfrom
shparkcubrid wants to merge 2 commits intoCUBRID:developfrom
Conversation
Contributor
Author
|
/run medium, sql |
Contributor
Author
|
/run all |
Contributor
Author
|
/run all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
http://jira.cubrid.org/browse/CBRD-26475
Purpose
9.2 버전에서는 옵티마이저가 Sort Merge Join을 선택하지 못하도록 변경되었다. 이전 이슈를 확인해 보면, Nested Loop Join을 선택해야 할 질의에서 Sort Merge Join이 선택되면서 성능 저하가 발생했고, 이로 인해 장애로 이어진 사례가 있었다. 당시에는 정확한 원인을 파악하지 못한 채 전반적으로 Sort Merge Join을 비활성화한 것으로 보인다. 추정컨대, 통계 정보 기반 estimation 오류로 인해 시간이 지남에 따라 선택도가 실제보다 낮게 평가되었고, 그 결과 옵티마이저가 조인 대상 데이터가 적다고 잘못 판단하여 Sort Merge Join을 선택했을 가능성이 있다. 현재는 이러한 부정확한 estimation 관련 로직이 모두 제거되었다. 이에 따라 Sort Merge Join과 Hash Join을 옵티마이저가 다시 선택할 수 있도록 수정한다.
Implementation
USE_HASH 힌트 없이도 옵티마이저는 hash join을 선택한다.
Sort Merge Join은 hash join 대비 성능상의 이점이 없으므로, 기존과 동일하게 힌트 사용이나 파라미터 변경이 있는 경우에만 선택한다.
hash join cost 계산 공식
Remarks
예상 페이지 수를 산정하는 데 사용되는 projected_size가 잘못 계산되어 이를 수정했다.