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

PK 및 Index 의 조회성능 관찰하기 #3

Open
Sun26-Avrin opened this issue Jan 28, 2022 · 0 comments
Open

PK 및 Index 의 조회성능 관찰하기 #3

Sun26-Avrin opened this issue Jan 28, 2022 · 0 comments

Comments

@Sun26-Avrin
Copy link
Owner

Sun26-Avrin commented Jan 28, 2022

실험결과

  • 30만개 데이터로 20회 측정 평균값임
  • Book은 PK가 GeneratedValue, cBook은 PK가 복합키(name+author)로 구성됨

1
2

깨달은 점

  • insert, update, delete 시 인덱스의 정렬비용은 생각보다 크지 않다.

인덱스 정렬알고리즘을 삽입정렬로 선택했을 경우, 정말로 비용이 크지않다.

거기다가 삽입위치를 binarySearch로 탐색할 경우 log(N) 의 비용일 것이며, 마지막 삽입 인덱스를 기억하고 범위를 줄여주면 더 성능이 좋아 질 것이다.

그러니까 결론은, 데이터의 갯수 N이 엄청 큰 수가 되었을 경우, 정렬비용으로 인한 부하가 발생할 것이며 이는 DB를 분산시켜 해결하면 된다. (샤딩)

테스트코드

블로그포스팅

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

No branches or pull requests

1 participant