Skip to content

[6.x] Look an entries field's entries up once in listings - #15890

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
DanielDarrenJones:perf/6x-entries-field-listing
Nov 13, 2026
Merged

jasonvarga merged 1 commit into
statamic:6.xfrom
DanielDarrenJones:perf/6x-entries-field-listing

Conversation

@DanielDarrenJones

Copy link
Copy Markdown
Contributor

An entries field in a Control Panel listing looks its entries up twice for every cell.

Entries::getItemsForPreProcessIndex() asks queryBuilder() for a query and runs it with whereAnyStatus(). To build that query, queryBuilder() has already run one: it finds the selected entries, moves each to the right site, and takes their ids. The second query then finds those same ids again, in the same order, with no status to filter by.

The listing now uses the entries from the first lookup: once each, with any substitutes (live preview) applied, as the second query would have given them. augment() and the query builder it returns aren't touched.

Numbers

Control Panel listing requests, each in its own process, three alternating rounds of eight:

before after
25 articles, two entries fields 402 ms 370 ms -8.1%
the same, searched 390 ms 352 ms -9.6%
50 notes, mixed fields 119 ms 96 ms -20.1%

The responses are byte for byte the same.

Tests

The entries are looked up once (fails without the change). Three more pin what the listing gets and pass before and after: an entry selected twice is listed once, entries are moved to the parent's site with drafts kept, and a substituted entry is the one used.

@jasonvarga
jasonvarga merged commit 7e91aa0 into statamic:6.x Nov 13, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants