I would expect this query to be very efficient:
SELECT ?item ?sitelinks WHERE { ?item wikibase:statements ?sitelinks. } ORDER BY DESC(?sitelinks) LIMIT 10
But it times out. The same query with another numeric predicate, like wdt:P2067 (mass), is fairly efficient. I suspect Blazegraph for some reason doesn’t have an index for sorted wikibase:statements (or whatever the equivalent Blazegraph term is)… perhaps because it’s xsd:integer instead of xsd:decimal?
Same situation for wikibase:sitelinks.
Motivation: a Wikipedia user suggested searching for items wtih most sitelinks but no dewiki article. This query should find such items, but also times out:
SELECT ?item ?sitelinks WHERE { ?item wikibase:sitelinks ?sitelinks. MINUS { ?deArticle schema:about ?item; schema:isPartOf <https://de.wikipedia.org/>. } } ORDER BY DESC(?sitelinks) LIMIT 10