Page MenuHomePhabricator

links query for images takes 200+ seconds on master
Closed, ResolvedPublic

Description

Author: bugzilla_wikipedia_org.to.jamesd

Description:
Seen on Ariel:

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

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.

Requests/suggestions:

  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.

  1. 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.


Version: 1.3.x
Severity: normal
OS: Linux

Details

Reference
bz973
TitleReferenceAuthorSource BranchDest Branch
build: Add wmf-certificates package for production TLS certsrepos/abstract-wiki/wikifunctions/function-evaluator!30jforresterwmf-certificatesmain
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 7:04 PM
bzimport set Reference to bz973.
bzimport added a subscriber: Unknown Object (MLST).

Have added temporary LIMIT 500. Paging etc would be better.

bugzilla_wikipedia_org.to.jamesd wrote:

Thanks.

bugzilla_wikipedia_org.to.jamesd wrote:

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.

bugzilla_wikipedia_org.to.jamesd wrote:

Assume fixed in 1.5 - at least worked around.