Last modified: 2010-05-15 15:28:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 973 - links query for images takes 200+ seconds on master
links query for images takes 200+ seconds on master
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
All Linux
: Normal normal with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2004-12-01 23:19 UTC by Jamesday
Modified: 2010-05-15 15:28 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Jamesday 2004-12-01 23:19:13 UTC
Seen on Ariel:

jawiki 211 Query SELECT cur_namespace,cur_title FROM 
imagelinks,cur WHERE il_to='Stubico.png' AND 

20,135 records returned by this query. A select count(*) 
on imagelinks for this il_to on a slave took under a 
second on Bacon, so getting the cur records is the slow 
part. Will be helped by a smaller cur record. By the time 
it had finished, Ariel had accumulated more than 500 
queries outstanding. Adding it to querybane, which may 
block display of this image description page for ja.


1. Switch this query to use database slaves.
2. If there is a limit on how many articles are 
displayed, add that to a limit statement in this query.
3. If no display limit yet, do SELECT count(*) FROM 
imagelinks WHERE il_to='Stubico.png' first, then have 
some suitable partial display when there are many 
records. Assuming this is an image description pagethis 
lets people get to an image description page without 
triggering a costly query. Maybe display full list on a 
linked page and only the first 50 or 100 on the main 
image description page.
3b When doing 3a, don't add an order by clause - you'll 
force retrieval of many more records to get the properly 
ordered subset.
3c. As temporary workaround, add limit 500 or limit 1000 
to the query.
Comment 1 Brion Vibber 2004-12-02 02:50:51 UTC
Have added temporary LIMIT 500. Paging etc would be better.
Comment 2 Jamesday 2004-12-03 21:53:11 UTC
Comment 3 Jamesday 2004-12-17 04:15:58 UTC
Rather than the select count, use limit 501 instead of 500, don't display result
501 and use the presence of 501 to tell you that there are more results. One
less query to make.
Comment 4 Jamesday 2005-11-12 23:19:55 UTC
Assume fixed in 1.5 - at least worked around.

Note You need to log in before you can comment on or make changes to this bug.