Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/select query #24

Merged
merged 4 commits into from
Jun 19, 2024
Merged

Fix/select query #24

merged 4 commits into from
Jun 19, 2024

Conversation

nove1080
Copy link
Collaborator

select 쿼리 성능 개선

+ " AND td1.timeLeftRegDt = ( "
+ " SELECT MAX(td2.timeLeftRegDt) "
+ " FROM TrafficDetailEntity td2 "
+ " WHERE td2.traffic = td1.traffic)")
List<TrafficDetailEntity> findMostRecenlyData(@Param("trafficIds") List<Long> trafficIds);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주어진 코드 패치는 좋아 보입니다. 개선을 제안하자면 'traffic' 컬럼과 'timeLeftRegDt' 컬럼에 대한 정확한 조인 조건이 필요합니다. 현재의 쿼리는 서브쿼리를 사용하여 가장 최근 데이터를 찾습니다. 그러나 성능 개선을 위해 인덱스를 고려할 수 있습니다. 또한 주석을 추가하여 쿼리를 설명하는 것이 도움이 될 수 있습니다.

# Conflicts:
#	api-repository/src/main/java/com/walking/api/repository/dao/traffic/TrafficDetailRepository.java
@belljun3395 belljun3395 merged commit c07d680 into main Jun 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants