I'm trying to display the list of articles with the most links on English Wikipedia: https://quarry.wmcloud.org/query/80666. I've run this query on other, smaller wikis, and results look good to me. However, on enwiki_p, it eventually times out and stops. How can I optimize it? Thank you!
Topic on Talk:Quarry
You are asking the database to create in memory, a new calculated column, based on every single link, for each article (7 million). That won’t / can’t scale. The solution is to download a local copy of the database, and in batches of x articles, run and store the calculation, and then run your top x query against those calculated results.