pimcore / pimcore

Core Framework for the Open Source Data & Experience Management Platform (PIM, MDM, CDP, DAM, DXP/CMS & Digital Commerce)
http://www.pimcore.com
Other
3.38k stars 1.43k forks source link

[Bug]: object_metadata table used in Advanced Object relations produce huge amount of null records #17720

Open gorisken opened 5 days ago

gorisken commented 5 days ago

Pimcore version

All

Steps to reproduce

Create 2 new data classes, for example order and orderline. In the order class add a Advanced One-to-Many Object relation field with the name lines, relate it to the orderline class and add multiple metadata fields (10 integers or strings for example). If you generate now 1000 order objects width multiple related orderlines without filling the metadata field. you will see that for each field there is a new record in the object_metadata table. This results in a huge amount of records in the table and blows up the database size because of the index on the table.

Actual Behavior

Each metadata field in an advanced relation gets a separate record, even if there is a null value. If I delete the null records from the table with a script. Everything remains working as expected, but the table size reduces with 20 to 80% depending on the fields with an actual value.

Expected Behavior

Create the separate record only if there is an actual value set in the field.

kingjia90 commented 3 days ago

Thank you, could you please specify in which version you have encoutered this issue? Just to rule out it is affected by https://github.com/pimcore/pimcore/pull/16482

gorisken commented 1 day ago

I checked the version and I'm running now on 11.1.5