Bug #101121
openPoor performance with INLINE + children having "label_alt" being set to a relation (n:1) column
0%
Description
I've noticed massive performance issues with INLINE relations when childrens have "label_alt" set to fields which are relations (n:1) themselves. Current scenario is:
- There are 400 "seminars", 4.000 "events", 20 "locations".
- Database layout is "seminars" <1:n> "event" <n:1> "location.
- TCA form for "seminar" contains "events" defined as INLINE, and "event" contains "location" as SELECT SINGLE.
- Table "event" has "label_alt => date, location, seminar" set (last two are n:1 relations).
Now opening the backend edit form for a "seminar" (which contains ~ 100 inline "events") leads to a never ending request on live system ("gateway timeout" on DDEV local). On database level, nothing could be improved by setting additional indices for all relationĂ¡l columns. As soon as "label_alt" is removed, there are no performance issues. In addition, this only happens when used within an INLINE relation. In plain list view for "event", this "label_alt" setting containing relations doesn't cause any problems.
I stumbled across this issue several times in the past. As far as is remember it always happens when "label_alt" refers to relations in combination with INLINE usage. I suppose the database queries in behind are not really good and perhaps they simply deal wrong with relations or don't use plain left joins ("event" <n:1> "location").
The only way i could work around this was, to use a custom label user function for the "event" label, which does "BackendUtility::getRecord()" for "location" and "seminar" in behind. So the 100 inline records themselves are not the problem and in general, we are not talking about a huge amount of records at all.