Page MenuHomePhabricator

Add SHOW EXPLAIN support to Quarry
Closed, ResolvedPublic

Description

It would be nice if Quarry users could find out what plan the database server is using to execute their queries. This should be possible with the [[http://s.petrunia.net/blog/?p=89|SHOW EXPLAIN]] functionality in MariaDB. SHOW EXPLAIN works by describing the plan of an actively executing query, so it can describe plans that traverse views.

The ideal implementation would probably be to automatically run SHOW EXPLAIN on all queries and store the result in parallel with the query output so that the user doesn't have to hit an "explain" button at just the right time to get results. An alternative solution would be to add a checkbox for "explain" near the "submit query" button.

Event Timeline

I'll try the button implementation, and show the button when the status is "running", and not store the results. Sometimes when you show explain too early the query plans of subqueries are not ready, so hitting the button just the right time can be harder for quarry itself than for human users.

Anyhow, explaining is for optimizing queries. If the query runs too fast for the user to hit the button, it doesn't really need optimizing :)

Change 368805 had a related patch set uploaded (by Zhuyifei1999; owner: Zhuyifei1999):
[analytics/quarry/web@master] Add explain button, and store the connection ID when running

https://gerrit.wikimedia.org/r/368805

Change 368805 merged by jenkins-bot:
[analytics/quarry/web@master] Add explain button, and store the connection ID when running

https://gerrit.wikimedia.org/r/368805

Mentioned in SAL (#wikimedia-cloud) [2017-07-31T16:22:08Z] <zhuyifei1999_> zhuyifei1999@quarry-runner-01:/srv/quarry$ sudo git fetch; sudo git checkout 6447943 T146483

Mentioned in SAL (#wikimedia-cloud) [2017-07-31T16:28:54Z] <zhuyifei1999_> Restarted celery-quarry-worker on quarry-runner-01 T146483

Mentioned in SAL (#wikimedia-cloud) [2017-07-31T16:31:34Z] <zhuyifei1999_> Repeated for quarry-main-01, but restarted uwsgi T146483

Should be fixed. After cleaning up browser cache there should be an "Explain" button just after "This query is currently executing...".