Page MenuHomePhabricator

Improve labelling performance in query builder
Closed, ResolvedPublic


As an editor I want to obtain result faster and without timeout as much as possible.

Labeling service in WDQS makes the query much slower (T212933: Optimize SERVICE wikibase:label and T166139: Query optimizer for labels should be using sub queries), specially for cases involving MINUS (see T272140#6756245)

Acceptance criteria:
The result query needs to be use labeling service wrapping the main query instead of being used directly. Like:

SELECT DISTINCT ?item ?itemLabel ?instance ?instanceLabel WHERE {
    SELECT DISTINCT ?item ?instance WHERE {
      ?item (p:P106/ps:P106/(wdt:P279*)) wd:Q2526255.
      ?item (p:P31/ps:P31) ?instance.
      MINUS { ?item (p:P31/ps:P31/(wdt:P279)*) wd:Q5. }
    LIMIT 5
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }