You can drop the « (wdt:P31/(wdt:P279*)) wd:Q18616576; » part, it’s useless. « ?prop wikibase:propertyType ?type. » is enough : https://w.wiki/4Kmp and it’s fast.
What seem to be really expensive is the label part, just adding the label (alone) at least triples or quadruples the query time, this takes us from less than a seconds to 3/4 seconds
Le ven. 29 oct. 2021 à 16:12, Thad Guidry thadguidry@gmail.com a écrit :
Hi David and team,
In Yi Liu's tool, Wikidata Property Explorer, I noticed that the query performance could be better ideally. Currently the query takes about 9 seconds and I'm asking if there might be anything to help reduce that considerably? Refactoring query for optimization, backend changes, anything you can think of Davd?
SELECT DISTINCT ?prop ?label ?desc ?type (GROUP_CONCAT(DISTINCT ?alias; SEPARATOR = " | ") AS ?aliases) WHERE { ?prop (wdt:P31/(wdt:P279*)) wd:Q18616576; wikibase:propertyType ?type. OPTIONAL { ?prop rdfs:label ?label. FILTER((LANG(?label)) = "en") } OPTIONAL { ?prop schema:description ?desc. FILTER((LANG(?desc)) = "en") } OPTIONAL { ?prop skos:altLabel ?alias. FILTER((LANG(?alias)) = "en") } } GROUP BY ?prop ?label ?desc ?type
Thad https://www.linkedin.com/in/thadguidry/ https://calendly.com/thadguidry/ _______________________________________________ Wikidata mailing list -- wikidata@lists.wikimedia.org To unsubscribe send an email to wikidata-leave@lists.wikimedia.org