Optimize GroupContentStorage and calls to it.

Created on 17 January 2022, almost 3 years ago
Updated 24 January 2024, 11 months ago

After #3254311: Denormalize group_type and plugin_id for GroupContent entity and add indexes β†’ , there are a lot of places where we can optimize the code by directly querying group content rather than first retrieving the group content types. We can also introduce #3040478: GroupContentStorage exceptions unnecessary(?) and/or undocumented β†’ in 2.0.x

Let's do that here in one big swoop.

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΉAustria mvonfrie

    Where is the change record regarding the removal of the $filters parameter of Group::getContentEntities($plugin_id, $filters) (or Group::getRelatedEntities($plugin_id, $filters) in 2.x/3.x)?

    How can I rewrite my code which uses the filters? In my case the filter depends on the bundle type of the related entities, for type A I have to filter on the group owner UID, for type B on the current user UID. And there are two more filters to apply, which are more difficult to explain.

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    https://www.drupal.org/node/3258952 β†’

    You can look into the method you were using and write a similar entity query.

  • πŸ‡ΊπŸ‡ΈUnited States hungdo

    The static query with distinct option consumes alot of memory in our site since our group_relationship_field_data table is roughly 200K records.

    Attaching a patch that uses GroupContentStorageInterface::loadByEntity() method instead.

Production build 0.71.5 2024