본문 바로가기

번역/Stackoverflow

[번역] Hibernate : dynamic-update dynamic-insert - Performance Effects

출처 : http://stackoverflow.com/questions/3404630/hibernate-dynamic-update-dynamic-insert-performance-effects

죄송합니다. 진짜 영어 못하는데 혹시 도움이 되실까바 번역하였습니다. 못보시겠으면 아래 요약글만 봐주세요. ㅎㅎ
 

-제목

 Hibernate : dynamic-update dynamic-insert - Performance Effects

 (하이버네이트 : @dynamicUpdate, @DynamicInsert  성능효과)

 

 

 

-질문

Using dynamic-update or dynamic-insert has positive, though generally slight only on performance, as also mentioned by

(다이나믹업데이트와 인서트를 사용하는 것은 긍정적이다, 비록 일반적으로 약간의 성능차이지만, 라고 아래 링크에서 언급되었다.)

http://www.mkyong.com/hibernate/hibernate-dynamic-update-attribute-example/

 

 

 

But the reference documentation mentions that this could have negative performance effects also as mentioned below in

(하지만 레퍼런스 에서는 이것은 좋지않은 성능 효과를 낼 수 있다고 말하며 또한 아래링크에서 언급되었다.)

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html#mapping-declaration-class :

Although these settings can increase performance in some cases, they can actually decrease performance in others.

(비록 그 세팅은 어떤 케이스에선 성능향상할 수 있다, 그것은 사실 다른 부분에서는 성능이 다운된다.)

Can anybody please suggest some example/scenario mentioning negative performance impact of the same?

(누군가 나에게 임팩트한 성능저하를 이르키는 예제와 시나리오를 추천해줘)

 

 

 

 

-답변

Hibernate caches the actual INSERT/SELECT/UPDATE SQL strings for each entity and the obvious benefit is that it doesn't have to compute the SQL when you want to persist, find or update an entity.

(하이버네이트는 각각의 엔티티별로 실제 INSERT/SELECT/UPDATE SQL 문자열을 캐시하고 이것이 뻔한 이득인게 분명한다 왜냐하면 너가 수정하거나 업데이터하거나 등록할 떄마다 SQL를 계산하지 않아도 되니까)

 

However, when using dynamic-insert or dynamic-update, Hibernate has to generate the corresponding SQL string each time and there is thus a performance cost on the Hibernate side.

(어쩃거나, 니가 다이나믹업데이트나 인서트를 사용할때, 하이버네이트는 각 타임마다 적절한 SQL 쿼리를 생성하고, 이것은 하이버네이트 측에서는 퍼포먼스 소비이다.)

 

In other words, there is a trade-off between overhead on the database side and on the Hibernate side.

(다른말로는 이것은 하이버네트 사이드와 데이터베이스 사이드의 오버헤드(성능) 교환이라고 보면되는데)

 

My point of view is that dynamic insert and dynamic update can be interesting for tables with a fat blob column or tables with a huge number of columns. In other cases, I'm not convinced that dynamic insert or update always means performance boost (I do not use them by default). But as always, you should measure it.

(내 관점에서는 엄청 큰 컬럼이나 엄청 많은 숫자의 컬럼을 가진 테이블들에겐 다이나믹 인서트와 다이나믹 업데이트는 꽤나 흥미로운 수 있다, 다른 케이스에서는(컬럼수가 적거나 부피가 작은 테이블) 항상 퍼포먼스가 좋다고 이것은 확신하지못한다. 아마 너는 그것을 측정해봐야할 것이다.

See also

 

-요약

 간단하게 요약하자면 다이나믹 업데이트나 인서트는 부피가 큰 컬럼의 테이블이나 굉장히 많은 수의 컬럼을 가진 테이블에겐 유리한데 보편적인 테이블에서는 하이버네이트의 캐시쿼리가 성능적으로 좋다는 말

 

 따라서 필요한 경우 해당 2가지 케이스의 쿼리들을 테스트해보고 좋은 것을 쓰라는 의미.