Page MenuHomePhabricator

Query timeout when using double path queries, but not when using path + subquery
Open, MediumPublic

Description

Using the following query on a small dataset (libraries in an Italian region)

SELECT DISTINCT ?item WHERE {
  ?item (wdt:P131/wdt:P131*) wd:Q1284.
  ?item (wdt:P31/wdt:P279*) wd:Q7075.
}

I get a timeout using Wikidata Query Service or the error message

#TOOL: legacy code failed in /data/project/magnustools/public_html/php/ToolforgeCommon.php on line 425

using a Wikidata List template. On the contrary, the query works using a named subquery

SELECT ?item with 
 { select ?item where 
  {
    ?item (wdt:P131/wdt:P131*) wd:Q1284.
   } 
 } as %i where
 { 
  include %i
  ?item (wdt:P31/wdt:P279*) wd:Q7075.
 }

or a different instance (museums instead of libraries)

SELECT DISTINCT ?item WHERE {
 ?item (wdt:P131/wdt:P131*) wd:Q1284.
 ?item (wdt:P31/wdt:P279*) wd:Q33506.
}

or a different similar region

SELECT DISTINCT ?item WHERE {
 ?item (wdt:P131/wdt:P131*) wd:Q1279.
 ?item (wdt:P31/wdt:P279*) wd:Q7075.
}

Is it a bug?
Thanks, Pietro

Event Timeline

Pietro updated the task description. (Show Details)
Pietro updated the task description. (Show Details)
Pietro renamed this task from Odd Wikidata timeout to Legacy code failed.Oct 14 2018, 7:38 AM

#TOOL: legacy code failed in /data/project/magnustools/public_html/php/ToolforgeCommon.php on line 425

Sorry, this is not WDQS message. I'd ask Magnus about it.

Smalyshev triaged this task as Medium priority.Oct 20 2018, 7:24 AM
Smalyshev added a project: WDQS-Optimizer.

Queries timing out in general are not a bug - some data sets and data paths would take more time than others. However if subquery works differently from plain query it may be an optimizer issue.

Smalyshev renamed this task from Legacy code failed to Query timeout when using double path queries, but not when using path + subquery.Oct 20 2018, 7:24 AM
Smalyshev moved this task from Incoming to Blazegraph on the Wikidata-Query-Service board.