Page MenuHomePhabricator

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

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 created this task.Oct 9 2018, 1:56 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 9 2018, 1:56 PM
Pietro updated the task description. (Show Details)Oct 9 2018, 2:30 PM
Pietro updated the task description. (Show Details)
Pietro updated the task description. (Show Details)Oct 9 2018, 3:35 PM
Pietro updated the task description. (Show Details)Oct 10 2018, 7:07 AM
Pietro updated the task description. (Show Details)Oct 10 2018, 7:10 AM
Pietro updated the task description. (Show Details)Oct 12 2018, 8:20 AM
Pietro updated the task description. (Show Details)
Pietro updated the task description. (Show Details)Oct 13 2018, 5:48 PM
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.

Pietro updated the task description. (Show Details)Oct 18 2018, 8:07 AM
Smalyshev triaged this task as Normal 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