On 2015-12-06 17:26, Lars Aronsson wrote:
If I write a [[link]] it will be blue if the page exists and red otherwise. But if I write [[:sw:link]] that will be an external or cross-wiki link, that is never red, as if it were impossible to know whether that page existed in Swahili Wikipedia.
But determining the existence of a page is just a quick database table lookup, and all databases run on WMF's servers, so it shouldn't be more expensive to look up a cross-wiki link, as long as it is one of WMF's wikis.
(...)
#ifexist already works across namespaces (well, of course), so is there any good reason it shouldn't work across wikis?
Oddly, the documentation says #ifexist is an "expensive" parser function. That doesn't make much sense to me. It's as if red/blue links were expensive, and most of our list pages should be banned. https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23ifexist
To add to what Alex and Florian said, the simple database lookup to check page existence is not actually that simple. When parsing a page, the query to determine link color (and to mark links to non-existent, redirect or disambig pages) is done in batches of 1000 links, after the whole page has been parsed and we know all the pages it links to. Special pages that have lists of links use a similar method.
This wouldn't be possible if we needed to query a different database for each link (at best, perhaps we could batch them per-database, which doesn't help the Wiktionary use case of links to various sites).
It's also why #ifexist is expensive: it needs a separate database query for each time it's used, to check for a single page, because it's impossible to determine the list of pages to check in advance.