Last modified: 2010-05-15 15:28:11 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
3c. As temporary workaround, add limit 500 or limit 1000
to the query.
Have added temporary LIMIT 500. Paging etc would be better.
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.
Assume fixed in 1.5 - at least worked around.