doctaxon added a comment.

@Jonas
This is such a query that runs into a timeout. It should give all Swedish women that have no sitelink to dewiki with counting the sitelinks and listing some properties to each item, and is needed for a dewiki community project. I cannot limit it because of the needed double ORDER BY, so the query has to run with unlimited result. If there is a longer timeout, the query will give a successful result. It will be great, if you can optimize it, if possible. Can you calculate, how much time the query will take to complete?

select
   ?sitelinks
   ?itemLabel
   ?itemDescription
   (group_concat(distinct ?P106l; separator=', ') as ?P106s) 
   (sample(?P18) as ?P18s)
   (group_concat(distinct ?P569l; separator=', ') as ?P569s)
   (group_concat(distinct ?P569prec; separator=', ') as ?P569precs)
   (group_concat(distinct ?P569cal; separator=', ') as ?P569cals)
   (group_concat(distinct ?P19l; separator=', ') as ?P19s) 
   (group_concat(distinct ?P570l; separator=', ') as ?P570s)
   (group_concat(distinct ?P570prec; separator=', ') as ?P570precs)
   (group_concat(distinct ?P570cal; separator=', ') as ?P570cals)
   (group_concat(distinct ?P20l; separator=', ') as ?P20s) 
   (group_concat(distinct ?P27l; separator=', ') as ?P27s) 
   ?item
with {
   select ?item ?sitelinks
   where {
      hint:Query hint:optimizer "None".
      ?item wdt:P27 wd:Q183; wdt:P21 wd:Q6581072; wdt:P31 wd:Q5; wikibase:sitelinks ?sitelinks .
      filter not exists {[] schema:about ?item; schema:isPartOf <https://de.wikipedia.org/>}
   }
} as %subquery
where {
   hint:Query hint:optimizer "None".
   include %subquery.
   optional {?item wdt:P106 ?P106. optional {?P106 wdt:P2521 ?P106l. filter(lang(?P106l) = 'de')}}
   optional {?item wdt:P18 ?P18.}
   optional {?item wdt:P27/rdfs:label ?P27l.}
   optional {?item wdt:P569 ?P569.}
   optional {?item p:P569/psv:P569 [wikibase:timePrecision ?P569prec; wikibase:timeCalendarModel ?P569cal]}
   optional {?item wdt:P570 ?P570.}
   optional {?item p:P570/psv:P570 [wikibase:timePrecision ?P570prec; wikibase:timeCalendarModel ?P570cal]}
   optional {?item wdt:P19/rdfs:label ?P19l.}
   optional {?item wdt:P20/rdfs:label ?P20l.}
   bind(substr(str(?P569), 1, 10) AS ?P569l).
   bind(substr(str(?P569), 1, 10) AS ?P569l).
   bind(xsd:integer(substr(str(?item), 33)) as ?num).
   service wikibase:label {bd:serviceParam wikibase:language 'de,[AUTO_LANGUAGE]'.}
}
group by ?sitelinks ?itemLabel ?itemDescription ?item
order by desc(?sitelinks) asc(?num)

TASK DETAIL
https://phabricator.wikimedia.org/T179879

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: doctaxon
Cc: chasemp, Lydia_Pintscher, Magnus, MichaelSchoenitzer_WMDE, MisterSynergy, doctaxon, Jonas, Ash_Crow, Daniel_Mietchen, Lucas_Werkmeister_WMDE, Jane023, Base, Gehel, Smalyshev, Ijon, Aklapper, Lahi, Gq86, Darkminds3113, GoranSMilovanovic, QZanden, EBjune, merbst, LawExplorer, Avner, FloNight, Xmlizer, jkroll, Wikidata-bugs, Jdouglas, aude, Tobias1984, Manybubbles, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to