Merge of entity classes with "mapped by" very slow

#1

Hi,

I have found a strange behavior when merging entities with "mapped by" set on @OneToMany relation. Even if object is fetched with find on the same transaction, merge is very slow. It's because on merge every single relation marked as LAZY is fetch from database.

Attached two examples - one with mapped by, second with adding entities list without "mapped by". The difference is huge event for such small objects - 2ms (without mapped by) vs ~50ms (with mapped by)

Is there any chance to optimize this case? Removing mapped by in our case can be quite hard, and now we have few cases where 'child' part of relation have almost 10k objects, so merging parent is also memory inefficient.

#2

Merging entity objects that are already managed should be very fast. Build 2.4.2_02 fixes it.

If the problem still exists, please post a modified test case that demonstrates it with the new build.

 

ObjectDB Support
#3

Thanks for new build. Fix is working correctly. The speed boost is huge for some part of our system.

#4

This optimization caused a regression bug, so it had to be changed in build 2.4.3_01.

Hopefully most of the performance gain will remain also with the new fix.

ObjectDB Support

Reply