Inefficiently loading all entities to get their titles

Created on 27 September 2017, about 7 years ago
Updated 14 August 2024, 4 months ago

I've encountered an issue where my Views page is failing to load due to entity_reference_exposed_filters' routine for acquiring node titles. At the bottom of \Drupal\entity_reference_exposed_filters\Plugin\views\filter\EREFNodeTitles::generateOptions there is a foreach loop that loads each entity to get its title. If you have a result set that is very large this quickly brings the down. Hopefully there's a more efficient (single query) way of acquiring the node titles.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States agileadam Maine, USA

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.

  • πŸ‡ΊπŸ‡ΈUnited States jrb Raleigh-Durham Area, NC, USA

    We were seeing tens of thousands of SQL queries due to this code loading all fields of all entities just to get their labels for the select list. The attached patch uses a custom query to select only the entity ID and label. It resulted in a huge performance improvement for us.

Production build 0.71.5 2024