Wikidata:SPARQL query service/query limits

It would be good, as a community, to try to map out the limits of what is currently possible with the query service -- in particular, for example, how far it is possible to broaden narrow queries before they time out.

In some cases, there may then be ways to re-write the queries, or change their query optimization to allow broader queries to be run, pushing the limits further. (In particular, if query performance suddenly "falls off a cliff" as the query is run for broader groups, as per the example presented on the optimization page, this can be a sign that the built-in optimization strategy has changed, which can sometimes be overcome by specifying a hand-ordering for the query).

In other cases, searching for the limits may reveal strange performance issues, such as some of those listed in the performance surprises section of the suggestions page. But it would be good to get an idea, generally, of what is and what is not possible, with the current set-up

See also Wikidata:SPARQL query service/queries/examples for examples of queries to test.

Items edit

Count distinct items edit

 Y 100299 in 0.6 seconds
 Y 2895793 in 9 seconds

Items plus descriptions in one language edit

LANG and equality edit

 Y 10^4 results in 7 seconds
 Y 10^5 results in 23/42 seconds
 Y 10^6 - Query timeout limit reached

langMatches edit

 Y 1 tinyurl.com/y8sxdwgu
 Y 10^4 tinyurl.com/yc5224u8

Items with missing description in one language edit

First sub-query returns 1126436 results; working queries can timeout

 Y ar incorrect results, 1029767
 Y ru likely correct results, 1113623
 Y it likely correct results, 820584
 Y de likely correct results, 944371

Geographical queries edit

AROUND substitute edit

 Y Places in Scotland within 50 miles of Edinburgh Airport (count) tinyurl.com/p3vyzrx 5661 places in 1.5 seconds
 Y Places in the UK within 50 miles of Edinburgh Airport (count) tinyurl.com/ppw2alm (Query timeout limit reached (was: "Concurrent Modification Exception" 30407 places in 42 seconds / 30407 places in 17 seconds)
 Y Places in the Netherlands within 50 miles of Schiphol Airport (count) tinyurl.com/ocmhcjv 151251 places in 54 sec (was: "Concurrent Modification Exception")

Search within box edit

 Y Places within 1 degree lat/long of the Arc de Triomphe (count) tinyurl.com/nzvowpg 17,931 places in 8.6 seconds
 Y Places within 3 degrees lat/long of the Arc de Triomphe (count) tinyurl.com/ng53my3 211991 in 58 seconds
 Y Places within 4 degrees lat/long of the Arc de Triomphe (count) tinyurl.com/pfynsyc Query timeout
 Y Places within 5 degrees lat/long of the Arc de Triomphe (count) tinyurl.com/oh86297 "Concurrent Modification Exception" / Timeout

Bounding box edit

 Y Maximum lat and long for places in UK tinyurl.com/orjxbae 165320 places in 22.7 seconds / 165320 in 11.7 seconds (As of 4/19/19 this query is timing out, but Denmark Q35 in place of Q145 yields 51,929 locations in 5.4 seconds.)
 Y Maximum lat and long for places in USA tinyurl.com/qgrexwm 227978 places in 17.8 seconds
 Y Maximum lat and long for places in Netherlands tinyurl.com/qg95pz6 315705 places in 21.5 seconds

Strange results edit

STRLEN edit

 Y

# User_talk:Ivan_A._Krestinin#Edits_with_no_change
# 9 latin chars according to http://www.ccli.gov.hk/iicore/iicore.html
SELECT  ?value 
(STRLEN(?value)                  AS ?stringLength)
(STRLEN("XX3386112"^^xsd:string) AS ?goal) 
WHERE
{
  wd:Q3785162 wdt:P950 ?value
}
Try it!