- Issue created by @alexpott
Using \Drupal\Core\Entity\Query\QueryInterface::latestRevision() to mark a query as only for the latest revision was slow prior to π Entity queries querying the latest revision very slow with lots of revisions Needs work . The most common use-case is the query in \Drupal\Core\Entity\ContentEntityStorageBase::getLatestRevisionId(). This could be further improved by doing something like:
$result = $this->getQuery()
->allRevisions()
->condition($this->entityType->getKey('id'), $entity_id)
->range(0, 1)
->sort($this->entityType->getKey('revision'), 'DESC')
->accessCheck(FALSE)
->execute();
However \Drupal\workspaces\EntityQuery\QueryTrait::prepare()
very much treats the call to ->latestRevision()
as API. We could do something like we did in
π
Entity queries for latest revisions should return the latest workspace-specific revisions
Postponed: needs info
and add metadata to the query to help workspaces.
Active
11.0 π₯
entity system
It affects performance. It is often combined with the Needs profiling tag.