Optimize number of queries by taking bundles into account

Created on 15 December 2023, 12 months ago
Updated 17 January 2024, 10 months ago

Configuration of reference fields require one of more bundles to be selected. This is optional for reference revisions fields, but if used, we have a small list of bundles to check for...

This information about bundles selected for reference fields can be used to reduce the number of queries performed to compile the list of entites that should be removed when the triggering entity is deleted.

Method getReferenceFields() is dynamically compiling the list of reference fields that point to the entity type of the entity being checked, but this list could be reduced if here is also checked the bundle of the entity being checked.

If the site has a complex structure of entities and bundles, this optimization could help reduce time spent while an entity is deleted.

Thank you

📌 Task
Status

RTBC

Version

2.3

Component

Code

Created by

🇪🇸Spain markus_petrux

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @markus_petrux
  • Status changed to Needs review 11 months ago
  • 🇪🇸Spain markus_petrux

    Here's a patch that refactors the method getReferenceFields() to get only fields that reference entities of the given type AND bundle.

  • 🇪🇸Spain markus_petrux

    Attached patch takes into account the case where target bundles has not been defined. So it should also be taken into consideration to find referenced entities.

  • Status changed to RTBC 10 months ago
  • 🇵🇱Poland piotrsmykaj

    @markus_petrux your patch makes sense and it's a significant performance improvement and makes the entity deletion process much faster. Reviewed and tested and works properly on my side.

Production build 0.71.5 2024